Introduction to Pipeline Hazards
You'll learn what prevents pipelined processors from achieving perfect throughput.
The Ideal vs. Reality
In a perfect world, our five-stage pipeline would complete one instruction every clock cycle after the initial fill time. We'd achieve a beautiful 5× speedup! Unfortunately, the real world has complications that disrupt this ideal flow.
What Are Pipeline Hazards?
Pipeline hazards are conditions that prevent the next instruction from executing in its designated clock cycle. Think of them like obstacles on an assembly line—if one station can't do its job because it's waiting for something, the whole line slows down or stalls.
Why Hazards Matter
These hazards directly impact our instruction-per-cycle (IPC) throughput. Instead of completing one instruction per cycle, we might need to insert "bubbles" (idle cycles) into the pipeline, reducing our effective performance. The processor can't maintain its ideal rhythm.
The Assembly Line Analogy
Imagine a car assembly line where:
- Station 3 needs to install a door
- But Station 2 is still painting that same door
- Station 3 must wait (creating a stall)
- All stations behind it also wait
- The line's throughput drops below one car per time unit
Similarly, in a processor pipeline, when one stage can't proceed, instructions pile up behind it, wasting clock cycles and reducing the speedup we hoped to achieve with pipelining.
Pipeline hazards are the primary reason real processors don't achieve theoretical peak performance—they're the friction in our otherwise smooth instruction flow.
Key Takeaway: Pipeline hazards are conditions that force the pipeline to stall, preventing ideal one-instruction-per-cycle throughput and reducing the performance benefits of pipelining.