Step 1: Understanding Hazards in Instruction Execution
- Hazards occur in pipelined execution due to dependencies between instructions.
- The three major types of hazards are:
1. RAW (Read After Write) – True dependency.
2. WAR (Write After Read) – Anti-dependency.
3. WAW (Write After Write) – Output dependency
Step 2: Elimination of WAR and WAW Hazards
- WAR (Write After Read) Hazard: Occurs when an instruction writes to a register before a previous instruction reads it.
- WAW (Write After Write) Hazard: Occurs when two instructions try to write to the same register in a different order than intended.
- These hazards are resolved using register renaming, which eliminates anti-dependencies.
Step 3: Evaluating the Options
- (A) Correct: Anti-dependence refers to WAR hazards, and register renaming eliminates both WAR and WAW hazards.
- (B) Incorrect: Dispatch is a stage in instruction scheduling, not related to hazard elimination.
- (C) Incorrect: Data hazards include RAW, but WAR and WAW are control hazards.
- (D) Incorrect: Execution stage does not handle WAR and WAW hazards directly.