Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1Learning Outcomes

One of the costs of pipelining is that it introduces pipeline hazards. A pipeline hazard, or simply hazard, is a situation in which a planned instruction cannot execute in the “proper” clock cycle. In other words, a hazard is when executing a combination of instructions would be impossible or would lead to incorrect program execution.

There are three types of hazards:

Structural hazard: The hardware in the processor cannot support the combination of instructions that we want to execute in the same clock cycle.

Data hazard: Instructions have data dependencies, and some instructions must wait for previous instructions to complete—otherwise outdated values would be used in computation.

Control hazard: The flow of execution depends on previous instructions. The wrong instructions are executed.

We discuss how to resolve hazards through various solutions in hardware, during execution time, or in the program code:

In practice, computers use a combination of the above techniques to maximize throughput and maintain the benefits of instruction-level parallelism that pipelining provides.