The computer can only do one thing at a
time. Each action must be broken down into the most basic steps. One
round of steps from getting an instruction back to getting the next
instruction is called the
Machine Cycle.
The Machine Cycle
|
Fetch - |
get an instruction from Main Memory |
Decode - |
translate it into computer commands |
Execute - |
actually process the command |
Store - |
write the result to Main Memory | |
For example, to add the numbers 5 and 6 and show the answer on the screen requires the following steps:
1. |
Fetch instruction: |
"Get number at address 123456" |
2. |
Decode instruction. |
3. |
Execute: |
ALU finds the number. (which happens to be 5) |
4. |
Store: |
The number 5 is stored in a temporary spot in Main Memory. |
5 - 8 Repeat steps for another
number (= 6) |
9. |
Fetch instruction: |
"Add those two numbers" |
10. |
Decode instruction. |
11. |
Execute: |
ALU adds the numbers. |
12. |
Store: |
The answer is stored in a temporary spot. |
13. |
Fetch instruction: |
"Display answer on screen." |
14. |
Decode instruction. |
15. |
Execute: |
Display answer on screen. |