A CPU executes program instructions, but modern performance depends on how effectively it overlaps work, predicts branches, and keeps execution units busy. These behaviors are mostly invisible to source code yet strongly influence which programs run quickly. section 8.1
A simplified CPU instruction path has four stages: fetch the instruction, decode its operation, execute it, and write the result to memory or a register. Separating these stages into independent units enables pipelining, allowing different instructions to occupy different stages at once. section 8.1.1
Important CPU performance tradeoffs include:
- Increasing clock frequency can reduce execution time, but raises power consumption and heat; excessive heat can cause thermal throttling. section 8.1.1
- CPU microarchitecture describes the internal organization used to execute instructions, including pipeline design; pipeline depth varies between designs. section 8.1.1
- Branch prediction and multiple threads help keep execution units busy, but they make actual performance differ from simple instruction-by-instruction timing. section 8.1
A conditional branch
Code that chooses between foo() and bar() becomes loads, comparisons, conditional branches, calls, and jumps at the instruction level. This exposes why branch behavior matters to CPU execution.








