What Is Branch Prediction?
The branch predictor is a nifty little device that helps CPUs, and other processors go faster by making sure they only execute instructions if they're going to be necessary. Branch prediction works by determining and completing the following education before the CPU has finished reading it. If you're running a program with some logic in it like "if this happens, then do that," branch prediction will ensure that only one of those two things happens—either the thing or the other thing. It's like if you were talking to someone at work, and they said, "If this happens, then do that." You'd say, "Gotcha." The trick is that two things are happening here: The CPU is processing instructions as fast as possible and figuring out which instructions it should execute next. It's like when you're driving somewhere new and want to make sure you don't miss your turnoff—you look ahead at where you think your destination will be so that when it comes up on the horizon, you'll be ready for it. Branch prediction takes advantage of this idea: The CPU looks ahead. Branches are the worst possible thing that could happen to a CPU. They can slow it down significantly and complicate things for the branch predictor. The branch predictor is a bit of code that sits in your processor, and it's just there to guess which way you will go when you do a conditional jump. It works by remembering what path you took last time, so if you always go left when you see a tree, the branch predictor will assume that's where you'll go again this time. If it happens to be wrong? Well, then it gets confused and has to start over again! CPUs take so long when branching instructions come in—the processor has to wait for the conditional jump to be executed before proceeding with its next instruction.
Related Terms by IT Support
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.














