A bus is a set of parallel wires (or traces on a circuit board) that transfer binary data between components. The three main buses connect the CPU to main memory and I/O controllers:
| Bus | Direction | What it carries | Connected to |
|---|---|---|---|
| Address bus | Unidirectional (CPU → memory) | Memory addresses | MAR on CPU side |
| Data bus | Bidirectional | Data and instructions | MDR on CPU side |
| Control bus | Bidirectional | Control signals (read, write, clock, interrupt, bus request) | Control Unit on CPU side |
Bus width is the number of parallel lines (bits) in the bus. Wider buses transfer more data per clock cycle:
Bus speed (in MHz or GHz) also affects throughput. Total bandwidth = bus width × bus speed.
There is a fundamental trade-off in memory design: speed vs. capacity vs. cost. Faster memory is more expensive per bit and typically smaller. The memory hierarchy organises storage by this trade-off:
| Level | Type | Speed | Capacity | Cost/bit | Volatile? |
|---|---|---|---|---|---|
| 1 — Registers | Inside CPU (flip-flops) | ~1 cycle | Bytes | Highest | Yes |
| 2 — L1 Cache | SRAM, on-chip | 2–4 cycles | 32–256 KB | Very high | Yes |
| 3 — L2 Cache | SRAM, on-chip | 6–20 cycles | 256 KB–4 MB | High | Yes |
| 4 — L3 Cache | SRAM, shared | 20–60 cycles | 4–64 MB | Moderate-high | Yes |
| 5 — RAM | DRAM | 60–100 cycles | GBs | Low | Yes |
| 6 — Secondary | SSD / HDD | Thousands of cycles | TBs | Very low | No |
SRAM (Static RAM) uses flip-flops (6 transistors per bit) to store each bit. It retains data as long as power is supplied and does not need refreshing. It is faster but more expensive and uses more silicon area, so it is used for cache.
DRAM (Dynamic RAM) uses a capacitor and single transistor per bit. Capacitors leak charge, so DRAM must be refreshed thousands of times per second. This makes it slower than SRAM but much cheaper and denser, making it suitable for main memory (RAM).
Cache is a small, fast bank of SRAM placed between the CPU and main memory. Its purpose is to reduce the effective access time by storing copies of frequently and recently accessed data and instructions.
Locality of reference explains why cache works:
Cache hit: the CPU finds the required data in cache — very fast. Cache miss: data is not in cache, so the CPU must fetch it from RAM — much slower. The hit rate is the proportion of accesses satisfied from cache. A higher hit rate means better performance.
Modern processors use multi-level caches (L1, L2, L3). L1 is smallest and fastest (per core); L3 is largest and shared between cores.
In memory-mapped I/O, I/O device registers are assigned addresses in the same address space as RAM. The CPU reads from and writes to device registers using the same instructions as for memory access, via the address and data buses. This simplifies the instruction set because no separate I/O instructions are needed.
8 questions · 20 marks · instantly marked
Timed exam conditions.
| Term | Definition |
|---|