Program Execution: The Fetch-Execute Cycle 

The machine language program that is stored in the computer’s memory as a sequence of instructions would be executed in the following manner:

  1. Each machine language instruction is first fetched from the memory and stored in an Instruction Register (IR). The address of the instruction to be fetched is stored in a register called Program Counter or simply PC. In some computers this register is called the Instruction Pointer or IP.

  2. After the instruction is fetched, the PC (or IP) is incremented to point to the address of the next instruction.
  3. The fetched instruction is decoded (to determine what needs to be done) and executed by the CPU. The CPU also updates the PC or the IP with the address of the next instruction if there is a jump.

The above sequence of fetch-execute-fetch-execute (illustrated in Fig. m010120.1) repeats till the computer is halted. Fig. m010120.2 shows an example of a detailed fetch-execute process.


Fig. m010120.1 The Fetch-Execute Cycle


Fig. m010120.2 An example of Fetch-Execute cycles of a processor