I'm studying compute rarchitecture and read that "control hazard are worse the deeper the pipeline is". But why is this the case? Is the branch deeper and therefore takes longer time to run?


If a control hazard isn't taken care of properly, the program is forced to wait until an instruction is finished before it can move on to the next instruction and thus performance is dramatically slowed down. This event usually occurs when we don't really know what the next instruction will be in the program. It wastes time, which is why we need pipelining so that we can do multiple things while we are waiting for an instruction to finish.

From a textbook I had when I was in college studying computer architecture: "Suppose our laundry crew was given the happy task of cleaning the uniforms of a football team. Given how filthy the laundry is, we need to determine whether the detergent and water temperature setting we select are strong enough to get the uniforms clean but not so strong that the uniforms wear out sooner. In our laundry pipeline, we have to wait until the second stage to examine the dry uniform to see if we need to change the washer setup or not."

But there are ways to avoid the issue:

  1. Stalling until the branch is finished
  2. Predict if a branch is taken
  3. Predict if a branch is not taken
  4. Delay the branch after an instruction
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.