6.6. The Machine Cycle

When software is installed onto a computer (by downloading it from the Internet or installing off a disk), the program and any associated files are stored in secondary memory. The program’s code is stored as a series of bits that represent machine instructions. The code remains there until the user chooses to execute the program in question, on which point sections of the code are loaded into the computer’s memory.

Execution

To actually run the code, the processor then needs to retrieve instructions one by one from memory so it can run them. This process consists of three stages: fetching the instruction, decoding the instruction, and executing the instruction - these three steps are known as the machine cycle. A processor spends all of its time in this cycle, endlessly retrieving the next instruction, decoding it, and running it.

Instruction Cycle

The video below demonstrates a simple program running on a computer. This imaginary computer shown uses special registers to hold memory address (MAR) and data that just came in from memory (MBR). It also uses registers called AL and BL to hold values temporarily. Don’t worry about the details of those other registers, focus on the fetch/decode/execute cycle and how the PC and IR are used.

Video: (jcHuWnIt6eI)

Materials on this page adapted with permission from:
Microprocessor Tutorial by Matthew Eastaugh