Course contentsShow
← Computer Science
Lesson 1162 of 2,87227. Pipelining and PerformanceFree lesson

Structural Hazards: Definition

Understanding structural hazards as resource conflicts when multiple instructions need the same hardware simultaneously.

Structural Hazards: Definition

What you'll learn: You'll understand what structural hazards are and why they occur in pipelined processors.

What Is a Structural Hazard?

A structural hazard happens when two or more instructions in a pipeline need to use the same piece of hardware at the exact same time—but that hardware can only handle one instruction at once. It's a resource conflict caused by insufficient hardware duplication.

Think of it like a single-lane bridge: if two cars from opposite directions arrive simultaneously, they can't both cross at the same time. One must wait, even though both are ready to proceed. The bridge itself (the hardware) is the bottleneck.

Why Structural Hazards Occur

In a pipelined processor, multiple instructions are in different stages simultaneously. Sometimes, different pipeline stages need the same resource in the same clock cycle. Common examples include:

  • Memory access conflicts: One instruction trying to fetch the next instruction while another reads/writes data from the same memory unit
  • Register file ports: Multiple stages trying to read or write registers when there aren't enough access ports
  • Functional units: Two instructions needing the same ALU or multiplier

If your processor has only one memory port, and both the Fetch stage (grabbing the next instruction) and the Memory Access stage (loading/storing data) need memory access in the same cycle, you have a structural hazard.

The Consequence

When a structural hazard occurs, the pipeline must stall—one instruction waits while the other uses the resource. This creates a "bubble" in the pipeline and reduces overall performance.

Key Takeaway: Structural hazards are pipeline conflicts caused when multiple instructions compete for the same hardware resource simultaneously, forcing the processor to stall until the resource becomes available.