How CPU Executes Program Instructions:
Let us examine the way the central processing unit, in association with memory, executes a computer program. We will be looking at how just one instruction in the program is executed. In fact, most computers today can execute only one instruction at a time, through they execute it very quickly.
Before an instruction can be executed, program instructions and data must be placed into primary memory from an input device or a secondary storage device. Once the necessary data and instruction are in memory, the central processing unit performs the following four steps for each instruction;
The control unit fetches (gets) the instruction from memory.
The control unit decodes the instructions (decades what it means) and directs that the necessary data be moved from memory to the arithmetic/logic unit. These first two steps together are called instruction time, or I-time.
The arithmetic/logic executes the arithmetic or logical instruction. that is, the ALU is given control and perform s the actual operation on the data.
The arithmetic/logic unit stores the result of this operation in memory or in a register. Step c and d together called execution time, or E-time.
The control unit eventually directs memory to release the result to an output device or a secondary storage device. The combination of I-time and E-time is called the machine cycle.