The scheduler cannot know this only with non-branching code. With branches, it cannot know which branch to take before it has actually done the calculation - as Pype already mentioned.d11in wrote: now the scheduler knows the tree (that's what the program will do/ the scheduler knwows exactly when a program requires an io operation or something other).
Consider that one of the most important features of a scheduler - aside from fairness and efficiency - is scaleability. With every year, the number of processes on an average system is increasing. (That's what's eating those GHz!) The Linux kernel made a very important step in finally catching up with "pro" operating systems in that it now implements a scheduler that is O(1) - that means, the scheduler takes constant time to select the next process to schedule - regardless of the number of processes waiting to be scheduled.
Sure, you can come up with a really "smart" scheduler that really kicks butt in your tests. But how does all that "smartness" scale once there are thousands of processes? Do you really want to look ahead what each process is going to do next?
