Computer Science, asked by muneebg33, 2 months ago

Explain structural hazards, data hazards and control hazards with the help of an
example.

Answers

Answered by fladderop
1

Answer:

Structural hazards

A structural hazard occurs when two (or more) instructions that are already in pipeline need the same resource. One solution to such resource hazard is to increase available resources, such as having multiple ports into main memory and multiple ALU (Arithmetic Logic Unit) units

Example: A situation in which multiple instructions are ready to enter the execute instruction phase and there is a single ALU (Arithmetic Logic Unit).

Data hazards occur when instructions that exhibit data dependence modify data in different stages of a pipeline. Ignoring potential data hazards can result in race conditions (also termed race hazards). There are three situations in which a data hazard can occur: read after write (RAW), a true dependency.

Example:read after write (RAW), a true dependency.

write after read (WAR), an anti-dependency.

write after write (WAW), an output dependency.

Control hazard occurs when the pipeline makes wrong decisions on branch prediction and therefore brings instructions into the pipeline that must subsequently be discarded. The term branch hazard also refers to a control hazard.

Example:Unconditional branches.

Conditional branches.

Indirect branches.

Procedure calls.

Procedure returns

Similar questions