O Level Computer Science 2210 · Area 1 · Computer systems

Computer architecture and the processor

The processor is where every instruction in a computer is actually carried out, and this topic is about the parts inside it and the order in which they work. You need to know what each register and bus is for, be able to describe the fetch-decode-execute cycle step by step, and explain how cores, cache and clock speed change performance. Marks are lost here by describing the cycle in the wrong order or by naming a component without saying what it does.

Not started

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.

Inside the processorThe control unit decodes; the ALU calculates; the registers hold what is being worked on.More cores, more cache and a faster clock all raise performance, but for different reasons.The processorcontrol unitALUregistersPC MAR MDR CIR accumulatorcachefast memory close to the processorMain memoryRAM / ROMheld outside the processoraddressdatacontrolFetch the next instruction from memory, decode it in the control unit, then execute it in the ALU. The cycle repeats.
A CPU block containing the control unit, the ALU and the registers, joined to main memory by the address bus, the data bus and the control bus.

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.

The CPU does not store the program permanently and it does not display anything. It processes, and everything else in the machine exists to feed it or to carry away what it produces.

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.

ComponentWhat 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
RegistersVery small, very fast storage locations inside the CPU that hold the address, instruction or data being worked on at that moment
BusesThe 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.

RegisterHolds
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 PC holds an address and the CIR holds an instruction. Confusing those two is the single most common error in this topic.

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.

BusCarriesDirection
Address busThe address of the location being read or writtenOne-way, from the CPU to memory
Data busInstructions and dataTwo-way, between the CPU and memory
Control busRead and write signals, clock pulses, interruptsBoth 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.

StageWhat happensComponents used
FetchAddress in PC goes to MAR, PC is incremented, read signal is sent, the instruction arrives in the MDR and is copied to the CIRPC, MAR, MDR, CIR, control unit, address bus, data bus, control bus
DecodeThe control unit works out which operation the instruction requiresControl unit, CIR
ExecuteThe operation is carried out; the ALU calculates, or data is moved, or the PC is changedALU, ACC, MAR, MDR, buses
In the fetch stage the PC is incremented before the instruction is executed, so it is already pointing at the next instruction while the current one is being dealt with.

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.

FeatureWhat it isEffect on performance
Number of coresThe number of complete processing units on the chipMore cores allow more instructions to be executed at the same time, if the software can use them
Size of cacheThe amount of fast memory on the chip holding recently used instructions and dataA larger cache gives more hits, so the CPU waits less often for main memory
Clock speedThe number of clock pulses per secondA faster clock completes more FDE cycles per second, so more instructions per second
Never write that more cores, a bigger cache or a faster clock makes the CPU 'better'. Say what each one physically allows, and then say why that is faster.

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 systemGeneral-purpose computer
Performs one dedicated functionPerforms many different functions
Program is fixed, usually in ROM or flash memoryPrograms are loaded into RAM and can be changed by the user
Small memory, low power, low costLarge memory, higher power, higher cost
Usually no screen, keyboard or full operating systemHas an operating system, screen and input devices
Examples: washing machine, car engine control, vending machineExamples: personal computer, laptop
The mark is for 'dedicated function'. If the answer describes a general-purpose computer that happens to be built into a device, it is not describing an embedded system.

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.

In a laptop

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.

In a phone

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.

In a washing machine

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.

In a car

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.

In a vending machine

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.

Q1What is the role of the CPU in a computer?
It processes the instructions and data that are input into the computer so that a result can be output.
Q2What is meant by a microprocessor?
A type of integrated circuit on a single chip that contains the processing unit of a computer.
Q3What does the control unit do?
It fetches and decodes each instruction and sends the control signals that make the other components carry it out, keeping the processor in step with the clock.
Q4What does the ALU do, and where does its result go?
It performs arithmetic (add, subtract, multiply, divide) and logic (comparisons, AND, OR, NOT) operations on values in registers. The result is held in the accumulator.
Q5What does the program counter hold?
The address of the next instruction to be fetched. It is incremented during the fetch stage.
Q6What is the difference between the MAR and the MDR?
The MAR holds the address of the memory location being accessed; the MDR holds the data or instruction that has just been read from that location, or that is about to be written to it.
Q7Which register holds the instruction being decoded?
The current instruction register (CIR). The control unit decodes the instruction held there.
Q8Describe the three stages of the FDE cycle.
Fetch: the address in the PC goes to the MAR, the PC is incremented, memory is read and the instruction arrives in the MDR and is copied to the CIR. Decode: the control unit works out which operation is required. Execute: the ALU carries out the operation, or data is moved, or the PC is changed.
Q9Which bus is one-way, and which is two-way?
The address bus is one-way, from the CPU to memory. The data bus is two-way, because data is both read from and written to memory.
Q10What is cache and why does a larger cache improve performance?
Cache is small, very fast memory on the CPU that holds recently used instructions and data. A larger cache gives more hits, so the CPU waits less often for slower main memory.
Q11How does the number of cores affect performance?
Each core is a complete processing unit, so more cores allow more than one instruction stream to be executed at the same time, provided the software is written to use them.
Q12What is an 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.
Q13What is an embedded system, and give three devices that use one.
A computer built into a larger device to perform one dedicated function, with its program normally fixed in ROM. Examples: a washing machine, a car's engine management system, a vending machine, a security alarm, a street light controller.
0 of 13 marked as known

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.

StateAO11 mark
State what is meant by a microprocessor.

Mark scheme — tick each point you actually made

Examiner tip: One mark, one idea: a single chip and an integrated circuit. Do not describe what it does instead of what it is.
DescribeAO12 marks
Describe the purpose of the arithmetic logic unit (ALU) in a CPU.

Mark scheme — tick each point you actually made

Examiner tip: Give both halves, arithmetic and logic, with an example of each. An answer that says only 'it does calculations' is worth one mark at most.
DescribeAO24 marks
Describe the fetch stage of the fetch-decode-execute cycle, including the role of the registers involved.

Mark scheme — tick each point you actually made

Examiner tip: Write the fetch stage as a sequence of moves between named registers. Each move is a mark, and the order matters.
ExplainAO23 marks
A computer is upgraded to a processor with a larger cache. Explain how this can improve the performance of the computer.

Mark scheme — tick each point you actually made

Examiner tip: Link three things: what cache is, what a larger one allows, and why that saves time. Stopping at 'it stores more data' loses the performance mark.
ExplainAO35 marks
A school is buying new computers for a design studio. One model has four cores, a larger cache and a faster clock than the other. Explain how each of these three features could improve the performance of the computers, and give one reason why the faster clock alone may not make the computers as fast as expected.

Mark scheme — tick each point you actually made

Examiner tip: Take the three features one at a time and say what each physically allows before saying it is faster. The last mark needs a limitation, not another benefit.
DescribeAO14 marks
Describe the purpose and characteristics of an embedded system, and identify two devices in which embedded systems are commonly used.

Mark scheme — tick each point you actually made

Examiner tip: The first mark is 'dedicated function'. Then give characteristics that follow from it, and finish with two examples from the syllabus list.
StateAO12 marks
State what is meant by an instruction set and state why machine code written for one processor may not run on a different processor.

Mark scheme — tick each point you actually made

Examiner tip: Keep both parts short. The second mark is about the instruction set belonging to the processor design, not about the program being faulty.

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

A student wroteA student wrote: 'The program counter holds the instruction that is currently being executed.'
Why it loses marksThe program counter holds an address, not an instruction, and it holds the address of the next instruction rather than the current one. The instruction being executed is held in the current instruction register.
The answer that scoresThe PC holds the address of the next instruction to be fetched. During the fetch stage that address is copied to the MAR and the PC is incremented. The instruction itself arrives in the MDR and is copied to the CIR, which is the register that holds the instruction being decoded and executed.
A student wroteA student described the fetch stage as: 'The CPU reads the instruction from the address in the MAR and puts it in the CIR.'
Why it loses marksA step has been missed out. The instruction arrives from memory in the memory data register first and is then copied into the CIR. Without the MDR the description does not show how the instruction got from the data bus into the processor.
The answer that scoresThe address in the PC is copied to the MAR, the PC is incremented, and the control unit sends a read signal on the control bus. The instruction at that address travels along the data bus and is stored in the MDR. It is then copied from the MDR into the CIR, where the control unit can decode it.
A student wroteA student wrote: 'Adding more cores always makes a computer faster.'
Why it loses marksMore cores only help when the work can actually be split into parts that run at the same time. A program written as a single sequence of instructions uses one core, and the extra cores sit idle, so the performance is unchanged.
The answer that scoresA core is a complete processing unit, so a multi-core processor can execute more than one instruction stream at the same time. This improves performance when the software is written to run in parallel, or when several programs are running at once. A program that cannot be split up will not run any faster on more cores.
A student wroteA student wrote: 'An embedded system is a small computer, such as a laptop, that is built into another device.'
Why it loses marksThis describes a general-purpose computer that happens to be small. The defining feature of an embedded system is that it performs one dedicated function with a fixed program, which a laptop does not do.
The answer that scoresAn embedded system is a computer built into a larger device to perform one dedicated function, with its program normally fixed in ROM and only a small amount of RAM. A washing machine controller, a car's engine management unit and a vending machine controller are embedded systems. A laptop is a general-purpose computer because it runs many different programs for many different purposes.
A student wroteA student explained a faster clock by writing: 'A higher clock speed means the CPU has more cores.'
Why it loses marksThe two features have been confused. Clock speed is the number of pulses per second and sets how fast each cycle runs; the number of cores is how many processing units there are and sets how much can run at once.
The answer that scoresThe clock sends a regular pulse that paces the processor, and each step of the FDE cycle takes a fixed number of pulses. A higher clock speed means more pulses per second, so more cycles and more instructions are completed each second. The number of cores is a separate feature: it is the number of complete processing units on the chip, allowing more than one instruction stream to run at the same time.

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.