Hardware and the Processor
The components of a computer system, the von Neumann architecture, the fetch decode execute cycle, and what actually makes one processor faster than another.
Components of a computer system
Every computer system has the same shape: input, process, output, with storage alongside.
- Input devices bring data in: keyboard, mouse, microphone, sensor, camera.
- The CPU processes it.
- Output devices present the results: screen, printer, speaker, motor.
- Memory holds what is being worked on now.
- Secondary storage holds it permanently.
The von Neumann architecture
Almost every computer follows the von Neumann architecture, whose central idea is the stored program concept: instructions and data are held in the same memory, and instructions are fetched one at a time to be executed.
Before this, a machine had to be rewired to do a different job. The stored program concept is why one laptop can be a browser, a compiler and a game without any physical change.
The cost is the von Neumann bottleneck: instructions and data share one route to memory, so they compete for it and the processor spends part of its time waiting.
Inside the CPU
| Component | Job |
|---|---|
| Control unit | Decodes instructions and sends the control signals that coordinate everything else |
| Arithmetic logic unit | Performs all calculations and all comparisons |
| Registers | Very small, very fast stores inside the CPU, each holding one value |
| Cache | Small, very fast memory holding recently and frequently used data and instructions |
| Buses | The connections carrying addresses, data and control signals |
The registers that matter
- Program counter (PC): the address of the next instruction to be fetched.
- Memory address register (MAR): the address currently being accessed.
- Memory data register (MDR): the data or instruction being moved to or from memory.
- Accumulator (ACC): the result of the most recent calculation.
The names tell you. Swapping them is the most commonly penalised error on this topic.
The fetch decode execute cycle
Fetch
- The address in the PC is copied into the MAR.
- The PC is incremented.
- The address goes out on the address bus and the instruction returns on the data bus into the MDR.
Decode
- The control unit works out what the instruction means and what it applies to.
Execute
- The instruction is carried out. A calculation is done by the ALU and the result goes into the accumulator. A jump writes a new address into the PC.
Then it repeats, billions of times a second.
Step 1 of 7 Fetch: the address in the program counter is copied into the MAR.
- The program counter holds the address of the next instruction.
- That address goes to memory along the address bus.
- The instruction comes back along the data bus and lands in the MDR.
- The control unit decodes it and works out what has to happen.
- The ALU executes it, and the program counter moves on by one.
What makes a processor faster
Clock speed
The clock produces pulses and one stage of the cycle happens per pulse. A 3 GHz processor produces three billion pulses a second, so a higher clock speed means more instructions completed per second. Heat and power consumption rise faster than speed does, which is why clock speeds stopped climbing around 2005.
Number of cores
A core is a complete processing unit. A quad core processor can genuinely execute four instructions simultaneously.
It rarely gives four times the performance. Some tasks are sequential, because each step needs the result of the last, and much software is not written to divide work across cores at all.
Cache size
Cache holds recently and frequently used instructions and data close to the processor, where they can be reached far faster than main memory. More cache means the processor waits for RAM less often.
Cache does not make the processor faster. It reduces the time the processor spends waiting, so more instructions are completed each second.
Embedded systems
An embedded system is a computer built into a larger device to do one dedicated task: a washing machine controller, a traffic light, a pacemaker. Because the task never changes it can use a modest processor and very little memory, which makes it cheap, reliable and power efficient, at the cost of being unable to do anything else.
- Clock speed: how many cycles the processor runs each second.
- Cores: how many instructions it can genuinely work on at once.
- Cache: fast memory on the chip, so it waits for RAM less often.
- A bigger number is not automatically a faster computer.
Key terms you must be able to define
- Von Neumann architecture
- A design in which instructions and data share the same memory and instructions are fetched one at a time.
- Stored program concept
- The idea that a program is held in memory alongside its data rather than wired into the machine.
- Control unit
- The component that decodes instructions and coordinates the rest of the processor.
- Arithmetic logic unit
- The component that performs calculations and comparisons.
- Register
- A very small, very fast store inside the CPU holding one value.
- Program counter
- The register holding the address of the next instruction to be fetched.
- Cache
- Small, very fast memory close to the CPU holding recently and frequently used data.
- Clock speed
- The number of clock pulses per second, measured in hertz.
- Core
- A complete processing unit within a CPU.
- Embedded system
- A computer built into a larger device to carry out one dedicated task.
Flashcards
Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.
Reach the top grade on this topic
This topic is about naming things precisely and explaining performance as throughput.
Use the register names inside the sentence. "The address in the program counter is copied into the MAR, and the instruction at that address returns along the data bus into the MDR" is a full mark answer.
Say what performance actually means. More instructions completed per second, not vaguely "faster". Cache reduces waiting. Cores allow genuine parallelism where the software supports it. Clock speed raises the rate of stages.
Qualify multi core claims. Four cores are not four times faster, because sequential tasks and single threaded software cannot use them.
Mistakes that cost marks here
- Swapping MAR and MDR.
- Saying the program counter is incremented at the end of the cycle rather than during fetch.
- Writing that cache increases clock speed. It reduces waiting.
- Saying more cores always means proportionally more performance.
- Describing an embedded system as simply a small computer rather than one dedicated to a single task.
A processor running at 3 GHz completes a clock cycle in a third of a nanosecond. In that time light travels about ten centimetres, which is why the physical size of a chip is now a genuine limit on how fast it can run.
Knowledge check
Exam-style questions
Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.
- LIt holds the result of the most recent calculation
The accumulator is the register that holds the result of the most recent calculation carried out by the arithmetic logic unit.
- LThe address in the program counter is copied into the MAR
- LThe program counter is incremented
- LThe address is sent out on the address bus
- LThe instruction is returned on the data bus into the MDR
The address held in the program counter is copied into the memory address register. The program counter is then incremented so that it already points to the following instruction. The address in the MAR travels out along the address bus to main memory, and the instruction stored at that address is returned along the data bus into the memory data register, ready to be decoded by the control unit.
- LCache holds recently and frequently used data and instructions close to the CPU
- LData in cache is accessed far faster than data in main memory
- LA larger cache means fewer fetches from RAM, so the CPU spends less time waiting
Cache is small, very fast memory located inside or extremely close to the processor, holding copies of the instructions and data that have been used recently or are likely to be needed next. Reading from cache takes a small fraction of the time that reading from main memory takes. Making the cache larger means a greater proportion of what the processor asks for is already there, so it has to fetch from RAM less often. Since a fetch from RAM leaves the processor idle while it waits, reducing how often that happens means more instructions are completed each second, which is what performance actually measures.
- LThe controller carries out one fixed, dedicated task
- LIt does not need to run other software or a general purpose operating system
- LSo a modest processor and very little memory are sufficient, which reduces cost
- LIt is also more reliable and uses less power, which matters for an appliance
The controller in a microwave has exactly one job, which is to run the cooking programme, drive the turntable and magnetron and read the keypad. Because that job is fixed and will never change, the system does not need to run arbitrary software and does not need a general purpose operating system to manage whatever a user might install. The single program can be written to fit the hardware precisely, so a very modest processor and a few kilobytes of memory are enough, which makes the component far cheaper to manufacture at the volumes involved. It is also more reliable, since there is very little that can go wrong and no software to become corrupted, and it consumes far less power, which matters in an appliance that is connected to the mains continuously.