In a multi threaded system, OS is running with many other programs derived by it. I assume Thats a lot of branches going on for different apps and OS itself. How can a processor predict sepecific branch in my code?
Ive seen effect of BP here. But my question is from all these branches going on background, how does a processor know this branch is this and that is that?
Wouldnt it get confused when its time to execute other threads?
I think progamatically keeping a record of each branch is not practical because that would be a lot of overhead. Because BP it self if it was software, would require different branches itself eliminating the purpose of BP.
So how is it handled by hardware? Or is it handled by software? And where does branch history go?