Several factors determine how fast a CPU can process instructions. OCR H446 requires you to know and evaluate these:
| Factor | How it affects performance |
|---|---|
| Clock speed | Measured in GHz (billions of cycles per second). A higher clock speed means more FDE cycles per second and faster execution, assuming other factors are constant. |
| Number of cores | Each core has its own ALU, CU and registers. Multiple cores can execute different threads simultaneously (true parallelism), improving throughput for multi-threaded workloads. |
| Cache size | Larger cache can store more frequently used data close to the CPU, increasing hit rate and reducing average memory access time. |
| Word length | The width of the data bus and registers. A 64-bit processor can process 64-bit values in a single operation, handling more data per cycle than a 32-bit processor. |
| Pipelining | Overlapping execution of multiple instructions to maximise utilisation of CPU components (see below). |
Pipelining is a technique that allows the CPU to work on multiple instructions simultaneously by overlapping the fetch, decode and execute stages. Without pipelining, each instruction must complete all three stages before the next one begins. With pipelining, as soon as one instruction moves from fetch to decode, the next instruction begins its fetch stage.
In a simple 3-stage pipeline:
Pipeline hazards are situations that disrupt the smooth flow of instructions through the pipeline, causing a stall (also called a bubble — idle pipeline stages).
| Hazard type | Cause | Example / Mitigation |
|---|---|---|
| Structural hazard | Two stages need the same hardware resource at the same time (e.g. a single memory port needed for both fetch and data access). | Mitigated by having separate instruction cache and data cache (Harvard-style caches), or additional hardware units. |
| Data hazard | An instruction depends on the result of a previous instruction that hasn't yet completed its execute stage. | Mitigated by operand forwarding (bypassing — passing the result directly from ALU output to the next instruction's input), or by stalling (inserting NOPs). |
| Control hazard | A branch instruction changes the PC, but the pipeline has already begun fetching/decoding subsequent sequential instructions that may not be needed. | Mitigated by branch prediction: the CPU predicts whether a branch will be taken and prefetches accordingly. If wrong, the incorrectly fetched instructions are flushed (pipeline flush). |
Branch prediction is a technique used to avoid control hazards. The CPU predicts whether a conditional branch will be taken and continues fetching instructions based on that prediction. If the prediction is correct, no stall occurs. If the prediction is wrong, the instructions fetched speculatively are flushed from the pipeline and the correct instructions are fetched, causing a penalty.
Modern processors use sophisticated dynamic branch predictors that track the history of branch outcomes to make more accurate predictions (often >95% accuracy).
8 questions · 20 marks · instantly marked
Timed exam conditions.
| Term | Definition |
|---|