The Central Processing Unit (CPU)

46 Computer Science Topics

We’ve created 46 modules covering every Computer Science topic needed for GCSE level. These are transferable across AQA, CIE, Edexcel, CIE & Internationally. Suitable for teachers or home educators alike.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

Candidates should be able to:

  • state the purpose of the CPU
  • describe the function of the CPU as fetching and executing instructions stored in memory
  • explain how common characteristics of CPUs such as clock speed, cache size and number of cores affect their performance.

What is the purpose and function of the CPU?

  • The purpose of the Central Processing Unit (CPU) is to carry out program instructions. Each CPU is designed to execute a specific group of instructions, the instruction set.
The Central Processing Unit (CPU) Image 1
A typical CPU, turned over to show the pins that connect it to the motherboard

To meet this purpose, the CPU carries out a series of functions in a continuous cycle.

1 – The Fetch step:

  • This involves retrieving an instruction from a memory address and storing it in the Current Instruction register.
  • The address of the instruction is stored in another register called the Program Counter (PC). After an instruction is fetched, the PC is updated so the CPU knows the address of the next instruction it has to fetch.

2 – The Decode step:

  • This involves the CPU identifying the operation code (op-code) part of the instruction which tells it which operation to perform. If the op-code requires the CPU to act on some data then the second part of the instruction will contain either the data or the memory address where the data is stored.

3 – The Execute step:

  • In this step the control unit links together the parts of the CPU that are needed to actually carry out (execute) the instruction.
  • Examples:
    • If the instruction involved integer arithmetic or logical operations then the arithmetic logic unit (ALU) would be connected to the relevant memory locations so that:
      • The data for the calculation can be passed along a data bus to the ALU as input.
      • The ALU can execute the required operation
      • The result of the operation can then be passed from the ALU along a data bus as output.
    • Some types of instructions alter the Program Counter rather than alter data. This allows programs to carry out iteration loops and conditional program execution rather than stepping through instructions in sequence.
    • Some instructions change the state of single-bit flag registers. These TRUE/FALSE registers are used to indicate the result of an execute step, for example a flag can be set to TRUE if two numbers are compared and found to be equal or if a subtraction produces a zero or a negative result.
    • Some instructions involve an additional write-back step if data is written back to RAM.

What are the components of a typical CPU?

There are huge variations in CPU designs but most will share the following key components:
An electronic clock that regulates the rate at which the CPU runs through the Fetch/Decode/Execute cycle, as well as synchronising all the various computer components.

  • The higher the clock speed, the more instructions the CPU can execute per second.
  • The speed of the clock (and therefore the speed of the CPU) is measured in Megahertz (MHz).

The control unit which performs the tasks of fetching, decoding and managing the execution of instructions and the storing of the results. It does this mainly by controlling the links between the other components of the CPU. It also contains various registers such as:

  • the Program Counter which stores the memory address of the next instruction.
  • the Current Instruction register which stores the instruction currently being executed.

An instruction unit which consists of:

  • The Arithmetic Logic Unit (ALU) which executes basic arithmetic and logical operations on integer data that it is linked to. Examples of such operations include:
    • Integer arithmetic operations (addition, subtraction)
    • Logic operations (AND, NOT, OR, XOR)
  • The Floating Point Unit (FPU) which performs math functions on floating point numbers (non-integer numbers).
  • Various registers such as the accumulator that are used to temporarily store data while instructions are being executed.

Buses, which are sets of tiny parallel wires that carry data between CPU components and between the CPU and external devices and RAM. A 32 wire bus can carry a 32 bit memory address or a 32 bit item of data. The three main bus types are:

  • address buses – used to set which memory address a CPU component is linked to for a read/write operation.
  • data buses – used to exchange the data between a memory address and the CPU when a read/write operation is carried out.
  • control buses – used to transfer command codes and return status signals between components of the CPU and external devices.

The bus management unit which manages the transfer of data along the external bus connections, including the links to RAM.

The Central Processing Unit (CPU) Image 2
A simplified diagram showing most of the main structures of a typical CPU

How do the characteristics of a CPU affect it’s performance?

Clock Speed:

The Central Processing Unit (CPU) Image 3
A diagram representing the CPU clock output
  • This is the rate at which the CPU runs and is controlled by an electronic clock built into the CPU. The frequency of this clock is measured in Hertz (Hz) so a 900 MHz CPU would complete 900 million clock cycles per second.
  • Few of the instructions that the CPU processes are actually completed in a single clock cycle and the actual number of cycles required will depend on the CPU design (this means that comparing one CPU with another just on clock speed can be too simplistic).

SUMMARY: A CPU with a high clock speed will process more instructions per second and will therefore have a higher performance than the equivalent CPU with a lower clock speed.

Cache Size:

  • If the CPU can process instructions and data faster than they can be fetched or exchanged with RAM then the CPU is in effect idle for some clock cycles. One solution is to build very fast cache memory into the CPU and use it as a buffer.

SUMMARY: The larger the cache size the higher the CPU performance because the CPU will spend less time accessing RAM so programs will execute faster.

Number of cores:

  • Processors originally had only one core so could only process one instruction at a time. A multi-core processor is made up of two or more independent processors (called cores).
  • A dual-core processor contains two cores and a quad-core processor contains four cores. Each core can process instructions independently of the other cores.
  • The biggest performance gain when using a multi-core processor is when the software has been specifically written to run on multiple cores.

SUMMARY: A multi-core CPU will have a higher performance than a single-core CPU with the same clock speed.


Overall Summary

Lower CPU performance Higher CPU performance
Low clock speed High clock speed
Small or no cache Large, multi-level cache
Single core Multi-core