The steps performed by the computer processor for each machine language instruction received. The machine cycle is a four-process cycle that includes reading and interpreting the machine language, executing the code, and then storing that code.
The process of cycling instructions may also be known as the E-cycle (execution cycle), I-cycle (instruction cycle), fetch-decode-execute cycle, or fetch-execute cycle.
Four steps of the machine cycle
- Fetch - Retrieve an instruction from memory.
- Decode - Translate the retrieved instruction into computer commands.
- Execute - Execute the computer commands.
- Store - Send and write the results back in memory.
Example of a machine cycle
Below is an example of a machine cycle performing the steps mentioned above for a math problem.
- The computer user enters a math problem that's stored in memory. The computer fetches that instruction from memory.
- The control unit decodes that math problem into instructions the computer understands.
- The ALU executes the instructions to get the answer to the math problem.
- The problem's answer is sent to and stored in memory where it can be accessed and displayed to the user.
Improvements with pipelining
Early computer processors needed to wait until an instruction completed all four stages before beginning work on the next instruction. However, today's computers use pipelining, which allows the processor to begin fetching a second instruction before it has completed the machine cycle for another instruction.