LightMySky

Pipelining and the Cost of a Hazard

Splitting instruction handling into stages lets one instruction start before the last has finished, raising throughput without making any single instruction faster. Dependencies between neighbouring instructions and unresolved branches force stalls, which is the price of the arrangement.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Draw a pipeline diagram for five instructions and count the cycles saved
  • Spot a data hazard between two neighbouring instructions and say how forwarding helps
  • Explain why a mispredicted branch throws away work

1 · Read

A processor splits each instruction into five steps and overlaps them like an assembly line. Five instructions need twenty five steps alone, yet the line finishes all five in nine rounds: five for the first, plus one for each follower. More finish per round, though no single one runs faster.

Overlap breaks when neighbours share data. If one instruction needs a result the prior one has not finished, the line must wait. Forwarding wires the fresh result straight back, which cuts most of the wait.

Try it together

A branch guesses which way the code turns and fills the line on that guess. When the guess proves wrong, every half-done step from the wrong path is thrown away and the line refills. That dumped work is the price of the wrong guess.

Good to know

Throughput counts finished instructions per round, latency counts rounds per instruction. Pipelining lifts the first number and leaves the second near five.

Overlap lifts finished work per round, hazards force waits, and wrong guesses dump half-done work.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Then practise

8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Pipelining and the Cost of a Hazard · Computing, ages 18 to 20 · LightMySky