A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k Introduction Comparison of scheduling based on some parameters On Uniprocessor system – most of it On Multiprocessor system Problems addressed by the schedulers
Introduction Objectives OSs analyzed FreeBSD 4.4 – pre SMPng Linux 2.4.18 – pre Preemtible kernel support Windows 2000 Convention Unit of work scheduled is Process
Comparison of scheduling on an uniprocessor system Responsibility Win2k – Kernel Dispatcher, running in the context of user process Linux, FreeBSD – Scheduler process Process types considered I/O and interactive processes CPU bound Real-time processes – Not in FreeBSD
Comparison of scheduling on an uniprocessor system Scheduling instances How scheduler picks-up a process Process priorities Win2k FreeBSD Linux Operation FBSD Linux Win2k Process blocked by I/O Yes Whenever a process is runnable Once/sec No when the process priority is changed either thru system call (setPriority) or by kernel (priority boosting) Multiple runnable processes with same priority When processor affinity changes 16 – 31 1 - 15 50 – 127 0 - 49 >= 1000 0 to 999 Kernel level priorities Kernel level priorities Real-time priorities User level priorities User level priorities Non real-time priorities
Comparison of scheduling on an uniprocessor system How scheduler picks-up a process Win2k picks a process with higher priority to run or if there are multiple processes with same priority then it runs them one by one for a quantum each Linux picks a process with higher Goodness value FreeBSD picks a process with lowest priority value Scheduler data structure Win2k, FreeBSD uses multilevel priority queue Linux uses linked list of runnable processes Wait queue Process type Formula for Goodness Real-time 1000 + real-time priority Non real-time Priority + quantum left in previous epoch + 1 (if the process being schedule shares address space with currently executed)
Comparison of scheduling on an uniprocessor system Quantum of process execution Trade-off in quantum Win2k - configurable but it’s 20ms for Professional and 120ms on uniprocessor server FreeBSD - it’s 100ms Linux No quantum for real-time FIFO processes Epoch Priority and quantum are related Quantum = Quantum/2 + priority, for next epoch Low priority process will never get to run in Win2k and FreeBSD but not the case in Linux Same priority processes share the quantum in FreeBSD and Linux but will for quantum each in Win2k
Comparison of scheduling on an uniprocessor system Priority boosting Win2k, priority boosting for I/O and interactive processes (1-15) E.g. 1 for disk I/O, 6 – keyboard FreeBSD, priority is boosted based on CPU usage When a process is awakened in kernel level then it’s assigned a kernel level priority ( 0 – 49) User level dynamic priority (50 – 127) is calculated by, Priority=50 + accumulated clock ticks on previous execution/4 + 2*nice Accumulated clocks ticks = (2*load)/(2*load+1) * Accumulated clock ticks + nice If a process is waiting on I/O for more than a sec. Accumulated clock ticks = ((2*load)/(2*load+1))# of seconds waiting * Accumulated clock ticks Linux, Priority + quantum left in previous epoch + 1
Scheduling analysis on FreeBSD
Scheduling analysis on Win2k
Scheduling analysis on Win2k
Scheduling analysis on Win2k
Multiprocessor scheduling & problems addressed Comparison of multiprocessor scheduling Win2k, Scheduler chooses a processor based on whether it ran the scheduled process before (cache reuse) or it’s the ideal processor of the process Linux Boosts priority by 15 if the process was last running on the processor Scheduling based on Cache Flush Time Problems addressed by the schedulers Win2k – priority inversion FreeBSD – thrashing, solved by high-level scheduler Linux – Quantum sharing between parent and child processes during forking