views:

81

answers:

2

Hi, I wish to know how Old Linux scheduling algorithm SJF (shortest job first) calculates the process runtime ?

+2  A: 

This problem actually is one of the major reasons why it is rarely used in common environments, since SJF algorithm requires accurate estimate of the runtime of all processes, which is only given in specialized environments.

In common situations you can only get estimated and inaccurate length of process running time, for example, by recording the length of previous CPU bursts of the same process, and use mathematical approximation methods to calculate how long it will run next time.

ZelluX
A: 

If you have some bandwidth to burn, you might be able to find the actual code here. Start at 2.0, where I think you'll find it as experimental.

SJF was (IIRC) extremely short lived, for the exact reasons that ZelluX noted.

I think your only hope to understand the method behind its madness lives in the code at this point. You may be able to build it and get it to boot in a simulator.

Edit:

I'm now not completely sure if it ever did go into mainline. If you can't find it, don't blame me :)

Tim Post