6.1Iron law
The idea
CPU time = instructions × cycles per instruction × time per cycle. Three factors, and you can improve any one.
Think of it like this: Trip time = distance × (time per km). Number of instructions is the distance, CPI is how hard each is, clock period is speed.
Why it exists
It is the one equation behind almost every performance question.
How it works
- IC depends on the program, compiler and ISA.
- CPI depends on the hardware design and instruction mix.
- Clock period depends on the technology and pipeline depth.
- Time = IC × CPI ÷ frequency.
Worked example: IC = 10⁹, CPI = 2, 2 GHz
Time = 10⁹ × 2 ÷ (2 × 10⁹) = 1 s.
Now play with it
- →Move the CPI slider: time scales linearly. Sweep the clock and see the curve.
clock (GHz) = 2 → time for 1e9 instr (s) = 0.8
T = IC × CPI / f. Halving CPI or doubling the clock has the same effect.
Check yourself
A program has 10⁹ instructions, CPI = 2, clock = 2 GHz. Execution time?
Exam notes (the dense version)
CPU time = Instruction count × CPI × clock period. Three levers: compiler/ISA (IC), microarchitecture (CPI), technology (clock).
Previous year questions: Performance: CPI, MIPS, Amdahl (3)
PYQs are grouped by topic, so this is the full set for Performance: CPI, MIPS, Amdahl; try the ones that match this subtopic. Open all 3 on the topic page.