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 Operation FBSD Linux Win2k Process blocked by I/O Yes Yes Yes Whenever a process is runnable Yes Yes Yes Once/sec Yes No No when the process priority is changed either thru system call (setPriority) or by kernel (priority boosting) Yes No Yes Multiple runnable processes with same priority Yes Yes No When processor affinity changes No No Yes How scheduler picks-up a process Process priorities Win2k Kernel level priorities User level priorities 16 – 31 1 - 15 FreeBSD Kernel level priorities User level priorities 50 – 127 0 - 49 Linux Real-time priorities Non real-time priorities >= 1000 0 to 999 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 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) 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 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 Compute bound process 60 50 40 Priority 30 CPU 20 Comput Bound(CB) & I/O Bound(IB) Processes 10 CB Priority 40 0:14 0:13 0:12 0:11 0:10 0:09 0:08 0:07 0:06 0:05 0:04 0:03 0:02 0:00 50 0:01 0 60 Time CB CPU 30 IB Priority 20 IB CPU I/O bound process 10 0 40 Priority 30 CPU 20 10 Time 0:15 0:14 0:13 0:12 0:11 0:10 0:09 0:08 0:06 0:05 0:04 0:03 0:02 0 0:01 Time 50 0:00 0: 00 0: 01 0: 02 0: 03 0: 04 0: 05 0: 06 0: 07 0: 09 0: 11 0: 13 0: 00 60 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
© Copyright 2026 Paperzz