Back to the 2026 paper

Module 5: Architecture Dependent Code Improvement

20262m

Which pipeline hazard occurs when an instruction depends on the result of a previous instruction?
(i) Structural hazard
(ii) Data hazard
(iii) Syntax hazard
(iv) Memory hazard

Worked SolutionAI Assisted

Answer: (ii) Data hazard

Explanation

A data hazard occurs when an instruction needs a value that a previous, still-in-flight instruction has not yet written back. The most common form is RAW (read-after-write):

ADD R1, R2, R3     ; writes R1
SUB R4, R1, R5     ; reads R1 -> must wait for the ADD result

Remedies: pipeline stalls, forwarding (bypassing), and compiler instruction scheduling (placing independent instructions in between).

  • Structural hazard: two instructions need the same hardware resource at the same time.
  • Control hazard: caused by branches.
  • "Syntax hazard" and "memory hazard" are not standard pipeline hazard classes.

(ii) Data hazard\boxed{\text{(ii) Data hazard}}

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.