On Sun, Apr 18, 2010 at 09:35, Aaron Lewis <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Hi, > B B B B I'm reading Operating System Concepts (7th Edition) , Written by > Abraham , Peter & Greg. > > B B B B In chapter 5.3 , it talks about a schedule algorithm: SJF > B B B B SJF means shortest jobs schedules firstly. > > B B B B To compare different process , thy use a process running time. > > B B B B e.g > B B B B B B B B P1 takes 6 secs to run > B B B B B B B B P2 takes 3 seconds > B B B B B B B B P3 takes 10 secs > > B B B B Then we should put those tasks in array like this: > B B B B P2 => P1 => P3 > > B B B B That looks much reasonable , but my question is , how does an OS know > that a process will takes longer time to finish its life ? > B B B B I think it's impossible to let OS know exactly how long a process will > take to run. > > > B B B B So far in my experience , i think there's a few ways to compare > Process running time: > > B B B B Forgive me if i have a poor experience on OS ;-) > > B B B B I) Number of Loops in a Program , can be detected by compiler > B B B B As long as you have any loops , you are slower than any straight ahead > program > > B B B B II) Length of Program , longer code takes longer time sometimes , not a > good way. > > > B B B B Anyone wants to share some experience with me ? > > B B B B Be very glad to hear your voice ;-) > > > > - -- > Best Regards, > Aaron Lewis - PGP: 0x4A6D32A0 > FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0 > irc: A4r0n on freenode > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkvLCq4ACgkQvf41sEptMqB/tgCgickA4qHtRxw7TpkAIi6ghHbz > x+kAoKaMkC0FU7NLioMw1hvhEuOvifO/ > =S080 > -----END PGP SIGNATURE----- > >
If I am not mistaking, SJF is usually desired while dealing of realtime processes. Those processes have a deadline associated by definition, that is the reason being realtime. Kristof

