The CPU and the fetch-execute cycle
The CPU (Central Processing Unit) carries out instructions from programs. It runs the fetch-decode-execute cycle constantly: fetch an instruction from memory, decode what it means, execute it, then move on.
- PC (Program Counter): holds the address of the NEXT instruction to fetch.
- MAR (Memory Address Register): holds the address currently being read/written.
- MDR (Memory Data Register): holds the data/instruction just fetched.
- Accumulator: stores results of calculations during execution.
CPU performance factors
Three things affect how fast a CPU runs:
- Clock speed: measured in GHz (billions of cycles per second). Higher = more fetch-execute cycles per second.
- Number of cores: each core can process instructions independently, so more cores can mean more done in parallel (but software must support multi-core use).
- Cache size: small, very fast memory on the CPU that stores frequently used data, so the CPU spends less time waiting on slower RAM.
Common mistake: saying 'more cores always means faster' — it only helps if the software is written to use multiple cores.
Von Neumann architecture
Most computers use the Von Neumann model: one memory store holds both data AND instructions, and they share the same bus system. Key idea: since data and instructions look the same in memory, the CPU must know which is which from context.
Embedded systems
An embedded system is a computer built into a larger device to perform a specific, dedicated task (e.g. a washing machine controller, a car engine management system, a microwave). Common mistake: forgetting that embedded systems usually run ONE fixed program, unlike a general-purpose computer.
Primary storage: RAM and ROM
- RAM (Random Access Memory): volatile (loses contents when powered off), holds currently running programs and data, read AND write.
- ROM (Read Only Memory): non-volatile, holds start-up instructions (e.g. BIOS), cannot normally be written to.
Common mistake: confusing 'volatile' (loses data when off) with 'non-volatile' (keeps data when off) — RAM is volatile, ROM and storage like SSDs are non-volatile.
Buses
Data travels around the computer along buses:
- Address bus: carries the memory address (one-directional, CPU to memory).
- Data bus: carries the actual data or instruction (bi-directional).
- Control bus: carries control signals like read/write commands.