The central processing unit (CPU) (Edexcel GCSE Computer Science): Revision Notes
The central processing unit (CPU)
What is the CPU?
The Central Processing Unit, commonly known as the CPU, serves as the brain of any computer system. Think of it as the command centre that takes programme instructions, figures out what they mean, and then carries out the required operations. Every task your computer performs - from opening a web browser to playing a game - depends on the CPU to decode and execute the necessary instructions.
The CPU works by following a continuous cycle: it fetches instructions from memory, decodes what those instructions mean, executes the required operations, and then moves on to the next instruction. This process happens millions or even billions of times per second in modern computers.
Main components of the CPU
The CPU contains several key components that work together seamlessly to process instructions and data. Understanding how these parts interact helps explain how computers can perform such complex tasks so quickly.
The three main components - control unit, arithmetic logic unit (ALU), and registers - must work in perfect coordination for the CPU to function effectively.
Control unit
The control unit acts like a traffic controller for the entire CPU. Its main job is to fetch programme instructions from the computer's main memory and then decode them to understand what operations need to be performed. Once it knows what to do, the control unit directs the other components of the CPU to carry out the necessary actions.
Think of the control unit as a conductor leading an orchestra - it doesn't play the music itself, but it coordinates all the different sections to work together harmoniously. The control unit ensures that instructions are executed in the correct order and that data flows to the right places at the right time.
Arithmetic logic unit (ALU)
The Arithmetic Logic Unit, or ALU, is where all the mathematical and logical operations take place. Whenever your computer needs to add numbers, compare values, or make logical decisions (like whether something is true or false), the ALU handles these tasks.
The ALU can perform basic arithmetic operations such as addition, subtraction, multiplication, and division. It also handles logical operations like comparing whether one value is greater than another, or determining if two values are equal.
These seemingly simple operations form the foundation for all the complex calculations computers can perform.
Registers
Registers are small, extremely fast storage locations built directly into the CPU. They temporarily hold data and instructions that the processor is currently working with. Because registers are located right inside the CPU, they can be accessed much more quickly than main memory.
Different registers have specific purposes - some store the data being processed, others hold memory addresses, and some keep track of the current instruction being executed. The number and type of registers can vary between different CPU designs, but they all serve the crucial role of providing instant access to the most frequently needed information.
The clock
Understanding the CPU clock
The CPU clock is a tiny quartz crystal that vibrates at an incredibly steady rate. Each vibration creates a "tick" that synchronises all the CPU's operations. Just like a metronome keeps musicians in time, the clock ensures that all parts of the CPU work together in perfect coordination.
Every action the CPU takes - whether it's fetching an instruction or performing a calculation - is triggered by these clock ticks. This synchronisation prevents different parts of the CPU from interfering with each other and ensures that operations happen in the correct sequence.
Clock speed measurement
Clock speed tells us how many times per second the CPU's clock ticks. This is measured in hertz (Hz), where one hertz equals one tick per second. However, modern CPUs are so fast that we typically measure their speed in gigahertz (GHz), where one gigahertz equals one billion ticks per second.
Most current CPUs operate at speeds around 3 GHz, meaning they can potentially perform three billion operations every second. This incredible speed is what allows modern computers to handle complex tasks like video editing, gaming, and running multiple programmes simultaneously.
Clock speed and performance
The relationship between clock speed and performance is straightforward in principle: a faster clock generally means more instructions can be processed per second. However, the actual performance depends on several factors beyond just clock speed.
Different instructions require different numbers of clock cycles to complete. Some simple operations might finish in just one clock tick, while more complex calculations could take several ticks. Additionally, some CPUs are designed to be more efficient, accomplishing more work per clock cycle than others.
Buses
What are buses?
In computing, buses are collections of wires that form the communication highways of a computer system. They provide the pathways for transferring data between the CPU and other components like memory, storage devices, and input/output hardware. Without buses, the different parts of a computer wouldn't be able to communicate with each other.
Think of buses like the road network in a city - just as roads allow cars to travel between different locations, buses allow electrical signals carrying data to move between different computer components.
Types of buses
The CPU uses three main types of buses, each with a specific purpose:
Control bus: This bus carries control signals between the CPU and other parts of the computer system. These signals coordinate activities and ensure that different components know when to send or receive data. The control bus helps manage the overall operation of the system.
Address bus: When the CPU needs to read from or write to a specific location in memory, it uses the address bus to specify exactly which memory location it wants to access. Each memory location has a unique address, and the address bus carries this addressing information.
Data bus: The data bus is responsible for transferring the actual programme instructions and data between the CPU and memory. This is the highway that carries the information the CPU needs to process.
Bus bandwidth and memory capacity
The bandwidth of the address bus determines how much memory a CPU can theoretically access. Each wire in the address bus can carry one bit of address information, so the total number of wires determines how many different addresses can be created.
Worked Example: 32-bit Address Bus Capacity
Step 1: Identify the formula Number of addresses =
Step 2: Calculate for 32-bit address bus Number of addresses = = 4,294,967,296 addresses
Step 3: Convert to memory capacity Since each address typically stores 1 byte: Total capacity = 4,294,967,296 bytes ≈ 4 gigabytes of memory
This relationship explains why older computers with narrower address buses were limited in how much memory they could use, and why modern systems with wider address buses can handle much larger amounts of RAM.
Bus direction
An important characteristic of buses is whether they are unidirectional or bidirectional. The control and address buses are typically unidirectional because information flows in only one direction - from the CPU outward to other components.
The data bus must be bidirectional because data needs to flow both ways. Sometimes the CPU sends data to memory (when storing information), and other times memory sends data to the CPU (when the CPU needs to read stored information). This two-way capability is essential for the CPU to function properly.
Key Points to Remember:
- The CPU is the brain of the computer that decodes and executes all programme instructions
- Three main CPU components work together: the control unit manages operations, the ALU performs calculations, and registers provide fast temporary storage
- The CPU clock synchronises all operations, with faster clock speeds generally enabling more instructions per second
- Buses are the communication pathways that connect the CPU to other components - control buses manage signals, address buses specify memory locations, and data buses transfer information
- The width of the address bus determines the maximum amount of memory a CPU can access, with wider buses supporting larger memory capacities