CPUs and architecture
In a pipeline, when the next instruction immediately uses the result of the previous one (a data hazard), which technique passes the result directly to the next instruction without waiting for it to be written to the register?
- AForwarding (bypassing)
- BVirtual memory
- CBranch prediction
Show answer and explanation
Answer: A. Forwarding (bypassing)
Forwarding (bypassing) routes an execution unit's output directly to a following instruction's inputs without waiting for the register write. Even if "r1 = r2 + r3" is immediately followed by "r4 = r1 × 2," no multi-cycle stall is needed. In a basic five-stage pipeline, a load result used immediately still causes a one-cycle stall because the data has not yet arrived (a load-use hazard); in deeper pipelines this stall is longer.
- A. Correct. The result is routed directly to the next instruction.
- B. Virtual memory manages address spaces and is not a hazard countermeasure.
- C. Branch prediction addresses control hazards from branches.