In computer architecture I'm confused between speculative execution & branch prediction. Are the same or different?

  • $\begingroup$ According to Wikipedia, predictive execution is one type of predictive execution. $\endgroup$ Jan 17, 2021 at 8:09
  • 1
    $\begingroup$ Speculation and prediction are not used on their own, but rather as part of more specific terms. What particular terms do you have in mind? $\endgroup$ Jan 17, 2021 at 8:10
  • $\begingroup$ They are used to speed up execution. For example, to predict if branch will be taken or not. $\endgroup$
    – user836026
    Jan 18, 2021 at 0:30
  • $\begingroup$ Great, so branch prediction is one term. Which term involves speculation? Is it speculative execution? $\endgroup$ Jan 18, 2021 at 21:12
  • $\begingroup$ yes .. it think speculative execution.. how its different from branch prediction, if its different. $\endgroup$
    – user836026
    Jan 19, 2021 at 1:45

1 Answer 1


“Branch prediction” will predict whether a particular branch is taken or not. The prediction can be right or wrong; whoever designs the hardware for it will want the prediction to be correct as often as possible.

Starting with a predicted branch, we don’t know if the instructions we execute should actually be executed, so we start with speculative execution. At some point the processor will learn correctly whether the branch should have been taken or not. If the branch was predicted correctly, the speculative execution is turned into non-speculative. If the branch was predicted incorrectly, all the results of speculative execution are thrown away and you continue with the correct branch.

Car analogy: You drive a car, I have the map. I say “I think you need to turn left” = branch prediction. You turn left = speculative execution. Later I tell you if the turn was correct or wrong.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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