Syllabus coverage
- Understand the role of the central processing unit (CPU) in a computer, and what is meant by a microprocessor
- Understand the purpose of the components in a CPU that has a Von Neumann architecture, including the arithmetic logic unit (ALU) and the control unit (CU)
- Describe the process of the fetch-decode-execute (FDE) cycle, including the role of each component in the process
- Understand the purpose of the program counter (PC), memory address register (MAR), memory data register (MDR), current instruction register (CIR) and accumulator (ACC)
- Understand the purpose of the address bus, data bus and control bus
- Understand what is meant by a core, cache and clock in a CPU and explain how they can affect the performance of a CPU
- Understand the purpose and use of an instruction set for a CPU
- Describe the purpose and characteristics of an embedded system and identify devices in which they are commonly used
Part of the O Level Computer Science syllabus 2210.
What the CPU does
The central processing unit (CPU) is the part of the computer that processes instructions and data that have been input, so that a result can be output. Every program, from a spreadsheet to a game, is at some point a list of instructions held in memory, and the CPU is the only component that can carry them out. It fetches an instruction from memory, works out what it means, does it, and then goes back for the next one, millions of times a second.
A microprocessor is a type of integrated circuit on a single chip: the whole processing unit, built from millions of transistors, sitting on one piece of silicon. The desktop computer, the laptop, the phone and the washing machine all have one, but they are not all the same processor. A processor designed for a phone is built to use as little power as possible, while one designed for a desktop is built to run as fast as possible.
Von Neumann architecture: the units
Almost every computer you will be asked about uses Von Neumann architecture. Its defining feature is that instructions and data are held together in the same main memory and travel to the CPU along the same buses. That is why a computer can be reprogrammed simply by loading a different program into memory, and it is also why a program can be corrupted by data overwriting it.
Inside the CPU there are two units. The arithmetic logic unit (ALU) carries out the arithmetic and the logic. The arithmetic is addition, subtraction, multiplication and division; the logic is the comparisons, such as testing whether one value is larger than another or equal to it, and the logical operations such as AND, OR and NOT. The ALU works on values held in registers and puts its result into the accumulator.
The control unit (CU) directs everything else. It fetches each instruction from memory, decodes it to find out which operation is required, and then sends the control signals that make the other components carry it out. It also keeps the timing of the processor, sending signals in step with the clock so that each step happens in the right order and data has settled before it is read.
| Component | What it does |
|---|---|
| Control unit (CU) | Fetches and decodes each instruction and sends the control signals that carry it out; keeps the rest of the CPU in step |
| Arithmetic logic unit (ALU) | Performs arithmetic (add, subtract, multiply, divide) and logic (comparisons, AND, OR, NOT) on values in registers |
| Registers | Very small, very fast storage locations inside the CPU that hold the address, instruction or data being worked on at that moment |
| Buses | The pathways that carry addresses, data and control signals between the CPU and memory |
The registers and what each one holds
Registers are tiny storage locations inside the CPU. They are far faster than RAM because they are on the same chip, and there are only a handful of them, so each one has a fixed and specific job. Exam questions almost always ask what a named register holds, so learn them as a list of contents rather than as a list of names.
The program counter (PC) holds the address of the next instruction to be fetched. The memory address register (MAR) holds the address of the memory location that is currently being read from or written to, so it is the register that drives the address bus. The memory data register (MDR) holds whatever has just been read from memory, or whatever is about to be written to it, so it sits on the data bus. The current instruction register (CIR) holds the instruction that has just been fetched and is now being decoded and executed. The accumulator (ACC) holds the result of the calculation the ALU has just performed, and it is one of the inputs to the next calculation.
| Register | Holds |
|---|---|
| Program counter (PC) | The address of the next instruction to be fetched |
| Memory address register (MAR) | The address of the memory location currently being read from or written to |
| Memory data register (MDR) | The data or instruction just read from memory, or the data about to be written to memory |
| Current instruction register (CIR) | The instruction currently being decoded and executed |
| Accumulator (ACC) | The result of the arithmetic or logic operation just carried out by the ALU |
The three buses
A bus is a set of parallel wires that carries signals between components. The CPU is connected to main memory by three of them, and each carries a different kind of signal in a different direction.
The address bus carries the address of the memory location being accessed, and it is one-way: the address always goes from the CPU out to memory, never the other way. Its width sets how many locations the processor can address, because each wire carries one bit of the address. The data bus carries the instructions and the data themselves, and it is two-way, because data is read from memory as well as written to it. Its width sets how much can be moved in one transfer. The control bus carries the control signals: the read and write signals that say whether memory is being read or written, the clock pulses that keep everything in step, and the interrupt and reset signals.
| Bus | Carries | Direction |
|---|---|---|
| Address bus | The address of the location being read or written | One-way, from the CPU to memory |
| Data bus | Instructions and data | Two-way, between the CPU and memory |
| Control bus | Read and write signals, clock pulses, interrupts | Both ways, as separate control lines |
The fetch-decode-execute cycle
The fetch-decode-execute (FDE) cycle is the sequence the CPU repeats for every single instruction, and it is the part of this topic that is most often examined as a description. Learn the order, and learn which component does what at each step.
Fetch. The address held in the PC is copied to the MAR. The PC is then incremented so that it holds the address of the following instruction. The control unit sends a read signal along the control bus, and the contents of the addressed location travel along the data bus into the MDR. From the MDR the instruction is copied into the CIR, ready to be worked on.
Decode. The control unit examines the instruction held in the CIR and works out what it is: which operation is required (the opcode) and which data or address it applies to (the operand). The CU then knows which signals to send and which components are needed.
Execute. The instruction is carried out. If it is an arithmetic or logic instruction the ALU performs the operation and the result goes into the accumulator. If it is a load or store instruction, data is moved between memory and a register, using the MAR and the MDR and the address and data buses. If it is a jump instruction, the PC is overwritten with a new address, so the next fetch comes from somewhere else. When the instruction has been executed the cycle begins again with the fetch of the instruction now pointed to by the PC.
| Stage | What happens | Components used |
|---|---|---|
| Fetch | Address in PC goes to MAR, PC is incremented, read signal is sent, the instruction arrives in the MDR and is copied to the CIR | PC, MAR, MDR, CIR, control unit, address bus, data bus, control bus |
| Decode | The control unit works out which operation the instruction requires | Control unit, CIR |
| Execute | The operation is carried out; the ALU calculates, or data is moved, or the PC is changed | ALU, ACC, MAR, MDR, buses |
Cores, cache and clock: what changes performance
Three features of a CPU affect how quickly it gets through work, and exam questions ask you to explain each one separately rather than just name it.
A core is a complete processing unit on the chip, with its own control unit, ALU and registers. A multi-core processor can execute more than one instruction stream at the same time, so several programs, or several threads of one program, can genuinely run in parallel instead of taking turns. More cores improve performance when the software is written to use them, and the gain is not proportional: four cores do not make a program four times faster if it cannot be split up.
Cache is a small amount of very fast memory built into the CPU that holds recently used instructions and data, on the principle that a program tends to reuse the same items. The CPU checks the cache before it goes to RAM, and a hit avoids the much slower trip to main memory. A larger cache holds more of the working data, so there are more hits and the processor spends less time waiting, which raises performance. Cache is expensive, which is why it is small.
The clock is the signal that paces the processor: it sends a regular pulse, and each step of the FDE cycle takes a fixed number of pulses. The clock speed, measured in hertz, is the number of pulses per second, so a faster clock means more cycles per second and more instructions completed per second. Raising the clock speed raises performance directly, but also raises heat and power consumption, which is why processors cannot simply be run faster and faster.
| Feature | What it is | Effect on performance |
|---|---|---|
| Number of cores | The number of complete processing units on the chip | More cores allow more instructions to be executed at the same time, if the software can use them |
| Size of cache | The amount of fast memory on the chip holding recently used instructions and data | A larger cache gives more hits, so the CPU waits less often for main memory |
| Clock speed | The number of clock pulses per second | A faster clock completes more FDE cycles per second, so more instructions per second |
The instruction set
An instruction set is the list of all the commands that a particular CPU can process. Every operation the processor is capable of, from adding two numbers to jumping to another part of a program, appears in that list as a single instruction, and the instructions are in machine code, the binary patterns the control unit can decode directly.
The instruction set belongs to the processor design, not to the program. Two different processors may have different instruction sets, so a program compiled to machine code for one will not run on the other; it has to be translated again. A programmer writing in a high-level language never sees the instruction set, because the compiler turns the statements into instructions from it, but the program that finally runs is made of nothing else.
Each instruction is normally in two parts: the opcode, which says which operation it is, and the operand, which says what the operation is applied to, such as a register or a memory address. A processor with a large instruction set can do complex operations in a single instruction; one with a small instruction set needs more instructions to do the same job but each one is simpler and faster to decode.
Embedded systems
An embedded system is a computer built into a larger device to perform one dedicated function. It is not a general-purpose computer: it cannot be used to write a letter one minute and browse the internet the next. Its program is fixed, usually stored in ROM or flash memory, and it starts running the moment the device is switched on.
The characteristics follow from that purpose. An embedded system normally has a microprocessor or microcontroller, a small amount of RAM, its program in ROM, and interfaces to the sensors and actuators of the device it controls. It is designed to be cheap, small, reliable and low-powered, and it often has to respond within a fixed time, which is why the software is kept simple and dedicated. There is usually no operating system in the sense a desktop has one, and often no screen or keyboard at all.
Embedded systems are everywhere: domestic appliances such as washing machines, microwaves and dishwashers; cars, where they control engine management, braking and airbags; security systems such as alarms and door entry systems; lighting systems, including street lights that switch on at dusk; and vending machines. The contrast the syllabus draws is with a general-purpose computer such as a personal computer or laptop, which runs many different programs for many different purposes and can be reprogrammed by its user.
| Embedded system | General-purpose computer |
|---|---|
| Performs one dedicated function | Performs many different functions |
| Program is fixed, usually in ROM or flash memory | Programs are loaded into RAM and can be changed by the user |
| Small memory, low power, low cost | Large memory, higher power, higher cost |
| Usually no screen, keyboard or full operating system | Has an operating system, screen and input devices |
| Examples: washing machine, car engine control, vending machine | Examples: personal computer, laptop |
Key terms you must be able to define
- Central processing unit (CPU)
- The component that processes instructions and data that have been input so that a result can be output. It fetches, decodes and executes instructions held in memory.
- Microprocessor
- A type of integrated circuit on a single chip that contains the whole processing unit of a computer.
- Von Neumann architecture
- A design in which instructions and data are stored together in the same main memory and are carried to the CPU along the same buses.
- Arithmetic logic unit (ALU)
- The unit inside the CPU that performs arithmetic operations and logic operations, such as comparisons and AND, OR and NOT, on values held in registers.
- Control unit (CU)
- The unit that fetches and decodes instructions and sends the control signals that make the other components carry them out, keeping the processor in step with the clock.
- Register
- A very small, very fast storage location inside the CPU that holds the address, instruction or data currently being worked on.
- Program counter (PC)
- The register that holds the address of the next instruction to be fetched.
- Memory address register (MAR)
- The register that holds the address of the memory location currently being read from or written to.
- Memory data register (MDR)
- The register that holds the data or instruction just read from memory, or the data about to be written to memory.
- Current instruction register (CIR)
- The register that holds the instruction currently being decoded and executed.
- Accumulator (ACC)
- The register that holds the result of the arithmetic or logic operation just carried out by the ALU.
- Bus
- A set of parallel wires that carries signals between components. The address bus is one-way, the data bus is two-way and the control bus carries control signals.
- Fetch-decode-execute cycle
- The sequence the CPU repeats for every instruction: fetching it from memory into the CIR, decoding it in the control unit, and executing it.
- Core
- A complete processing unit on a chip, with its own control unit, ALU and registers. A multi-core processor can execute more than one instruction stream at once.
- Cache
- A small amount of very fast memory built into the CPU that holds recently used instructions and data so that the CPU does not have to wait for main memory.
- Clock speed
- The number of clock pulses per second, measured in hertz. A faster clock completes more FDE cycles per second and so more instructions per second.
- Instruction set
- The list of all the commands that a particular CPU can process. The commands are in machine code, and each has an opcode and usually an operand.
- Embedded system
- A computer built into a larger device to perform one dedicated function, normally with its program fixed in ROM and with limited memory and power.
In context
2210 sets its questions inside systems a student already uses - a school network, a phone, a supermarket till, a vending machine, a website. These show how the theory is applied to a context you have not seen before, then you answer for the system you are given.
When you open a spreadsheet and type a formula, the CPU is running the FDE cycle for each instruction of the spreadsheet program. The formula's numbers are loaded from RAM into registers, the ALU does the arithmetic, and the result goes into the accumulator before being written back to memory. The laptop's performance is the product of all three features: a faster clock runs more cycles per second, a larger cache means fewer waits for RAM, and multiple cores let the spreadsheet recalculate while the screen redraws.
A phone uses a microprocessor designed for low power rather than maximum speed, because it runs on a battery and has no fan. It has several cores, and the operating system moves work between them: a light task such as reading a message may use one small, efficient core, while a game uses the faster cores. Cache and clock speed are balanced against battery life, which is why a phone's processor is not simply run as fast as a desktop's.
The controller in a washing machine is an embedded system. Its program is fixed in ROM, it has a very small amount of RAM, and it does one job: run the wash cycle. It reads a temperature sensor and a water-level sensor, opens the inlet valve until the level is right, heats the water to the set temperature, and turns the drum motor. It has no keyboard, no screen beyond a small display, and no operating system of the kind a PC has.
A modern car contains many embedded systems rather than one computer. Engine management reads sensors for airflow, oxygen and temperature and adjusts the fuel mixture many times a second; the braking system reads wheel-speed sensors and releases pressure when a wheel is about to lock. Each has a dedicated program in ROM and must respond within a fixed time, which is exactly why a general-purpose computer running several programs at once would not be suitable for the job.
A vending machine's controller is embedded. It reads the keypad and the coin or card reader as inputs, checks the selection against its fixed program, drives the motor that releases the item, and updates a small display. The program is dedicated to selling and dispensing, and the device cannot be used for anything else, which is what distinguishes it from a general-purpose computer.
Flashcards
Click a card to flip it. Mark honestly — the tracker uses this.
Exam-style questions
7 questions, 21 marks. Write your answer and press Mark my answer — it is marked against the scheme and tells you which points you made and what would gain the next mark. You can still reveal the scheme and mark it yourself instead.
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Exam technique for this topic
- When asked about the FDE cycle, answer in stages and name the register at each move: PC to MAR, memory to MDR, MDR to CIR, CU decodes, ALU or memory access executes. A description that stays at the level of 'the CPU fetches the instruction' scores very little.
- Say what a register holds, not what it is. 'The MAR holds the address of the location being accessed' scores; 'the MAR is a memory address register' does not.
- For performance questions, give the mechanism and then the effect: a larger cache means more of the working data is found on the chip, so the CPU waits less often for slower RAM. Naming the feature alone is worth nothing.
- For cores, add the condition: more cores only improve performance if the software is written to run in parallel. That qualification is often the mark that separates a good answer from a full one.
- For embedded systems, lead with 'dedicated function' and contrast it with a general-purpose computer. Then give examples from the syllabus list: domestic appliances, cars, security systems, lighting systems, vending machines.
Why students lose marks here
Where this fits in O Level Computer Science 2210
This page is one topic of Cambridge O Level Computer Science 2210. O Level Computer Science 2210 is the course home: every area and every topic in Cambridge's own order, the papers you sit and what each one tests, and the exam-practice tools. The full topic list, with each topic linked to its revision page, is on the O Level Computer Science 2210 syllabus page.