Running a program

Software programs are sets of instructions. For a CPU to execute these instructions, each one must first be translated into machine code – simple binary codes that activate parts of the CPU.

The CPU only performs a few basic functions:

  • performing mathematical operations like addition and subtraction
  • moving data from one memory location to another
  • making decisions and jumps to a new set of instructions based on those decisions

A piece of software, such as a game or web browser, combines these functions to perform more complex tasks.

The main parts of the CPU

The processor is made up of a control unit, an ALU and the registers

Arithmetic logic unit (ALU)

The ALU carries out calculations and makes decisions on the data sent to the processor.

Control unit (CU)

The CU, which is also called the controller, controls data moving through the processor, and controls the timing of operations and the instructions sent to the processor and the peripheral devices. The CU directs the system to carry out program instructions. It does the fetching, decoding, and managing of instructions.

Registers

Registers are also called internal memory or immediate access memory stores. A register is a small amount of fast temporary memory within the processor where the ALU or the CU can store and change values needed to execute instructions.

Different processors have different sets of registers. One important register is the program counter. This keeps track of the running order of the instructions and shows which instruction in the program is due to be executed next.

An introduction to processors