Sei sulla pagina 1di 12

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 Process blocked by I/O Whenever a process is runnable Once/sec 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 FBSD Yes Yes Yes Yes Yes No Linux Yes Yes No No Yes No Win2k Yes Yes No Yes No Yes

How scheduler picks-up a process


Process priorities

Win2k
Kernel level priorities 16 31 Kernel level priorities

FreeBSD
50 127 Real-time priorities

Linux
>= 1000

User level priorities

1 - 15

User level priorities

0 - 49

Non real-time priorities

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
Non real-time

1000 + real-time priority


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 its 20ms for Professional and 120ms on uniprocessor server FreeBSD - its 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 its 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 30 Priority CPU

Comput Bound(CB) & I/O Bound(IB) Processes


60 50 40 30 20 10 0 CB Priority CB CPU IB Priority IB CPU

20 10 0

0:00

0:01

0:02

0:03

0:04

0:05

0:06

0:07

0:08

0:09

0:10

0:11

0:12

0:13

Time

I/O bound process


60 50 40 30 20 10 0 Priority CPU

0: 00 0: 01 0: 02 0: 03 0: 04 0: 05 0: 06 0: 07 0: 09 0: 11 0: 13 0: 00

Time

0:00

0:01

0:02

0:03

0:04

0:05

0:06

0:08

0:09

0:10

0:11

0:12

0:13

0:14

Time

0:15

0:14

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 its 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

Potrebbero piacerti anche