Scheduling Introduction to Scheduling Bursts of CPU usage alternate with periods of I/O wait a CPU-bound process an I/O bound process
When to Schedule 1. At process creation 2. At process termination 3. At blocking system calls 4. At I/O interrupt Preemtive and non-preemtive scheduling algorithms
Goals of Scheduling
Scheduling in Batch Systems (1) (a) First-come-first-served (FCFS) (b) Shortest-job-first (SJF) - provably optimal if all jobs are known in advance (c) Shortest-remaining-time-next (SRTN)
Scheduling in Batch Systems (2) Three level scheduling
Scheduling in Interactive Systems (1) Round Robin Scheduling (a) list of runnable processes (b) list of runnable processes after B uses up its quantum Length of quantum: too short => waste of CPU time too long => poor response
Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes Static and dynamic priority allocations, e.g. 1/f.
Scheduling in Interactive Systems (3) Multiple queues Shortest process next; aging (weighted average) Guaranteed scheduling (1/n) Lottery scheduling - biased randomness, passing tickets Fair share scheduling
Scheduling in Real-Time Systems Schedulable real-time system Given m periodic events event i occurs within period Pi and requires Ci seconds Then the load can only be handled if
Policy versus Mechanism Separate what is allowed to be done with how it is done a process knows which of its children threads are important and need priority Scheduling algorithm parameterized mechanism in the kernel Parameters filled in by user processes policy set by user process
Thread Scheduling (1) Possible scheduling of user-level threads 50-msec process quantum, threads run 5 msec/CPU burst Application-specific thread schedulers
Thread Scheduling (2) Possible scheduling of kernel-level threads 50-msec process quantum threads run 5 msec/CPU burst
The UNIX scheduler is based on a multilevel queue structure
Scheduling in Windows (1) Mapping of Win32 priorities to Windows 2000 priorities
Scheduling in Windows (2) Windows 2000 supports 32 priorities for threads