Delayed branching can help in the handling of control hazards. For all delayed…

2008

Delayed branching can help in the handling of control hazards. For all delayed conditional branch instructions, irrespective of whether the condition evaluates to true or false,

  1. A.

    the instruction following the conditional branch instruction in memory is executed

  2. B.

    the first instruction in the fall through path is executed

  3. C.

    the first instruction in the taken path is executed

  4. D.

    the branch takes longer to execute than any other instruction

Attempted by 137 students.

Show answer & explanation

Correct answer: A

Correct answer: the instruction following the conditional branch instruction in memory is executed.

Key idea: Delayed branching reserves the instruction slot immediately after the branch (the delay slot) and executes that instruction regardless of whether the branch condition is true or false.

Why this handles control hazards: while the processor is resolving the branch target or condition, it performs useful work by executing the delay-slot instruction, which reduces the pipeline penalty from branches.

  • The instruction immediately after the branch is executed unconditionally, so compilers try to place a harmless or useful instruction there.

  • The first instruction in the fall-through path is only relevant when the branch is not taken; delayed branching executes the next-in-memory instruction even when the branch is taken, so these can differ.

  • The first instruction in the taken path is the branch target and is executed after the delay-slot instruction, not in its place.

  • The existence of a delay slot does not mean the branch takes longer to execute; it is a mechanism to hide branch latency by running the next instruction while the branch outcome is resolved.

Practical note: Assemblers or compilers often reorder or insert a safe instruction into the delay slot to ensure correct program behavior regardless of branch outcome.

Explore the full course: Gate Guidance By Sanchit Sir