DEV Community

AymanGamal-dev
AymanGamal-dev

Posted on

Program execution

Before we start talking about machine cycle we need to define what is the program;

A set of instructions to process data,
A computer execute the program to create output data from input data, both data and program are stored in memory.

Now, what is the machine cycle:

The central process unit (CPU) uses repeating cycle to execute the instructions in the program (one by one ), a simplified cycle can consist of three phases:

1- Fetch:
In fetch phase, the control unit orders the system to copy the next instructions into the instructions register in CPU, the address of this instruction ti be copied is held in the program counter register, after copying, program counter ++, to refer to the next instructions in memory.

2- Decode:
When the instructions is in the instruction register, it is decoded by control unit, the result of decode is Binary code for some operation that system will preform.

3- Execute:
The last phase; after decode ends the control unit sends the task order to a component in CPU.

Example:
The control unit sends the task to the system to load( read ) a data item from memory.

Next, what is the program instructions,

( photo example provided from google)

Happy to share knowledge with you:)

Top comments (0)