Scheduling Introduction to Scheduling Bursts of CPU usage
Scheduling Introduction to Scheduling • Bursts of CPU usage alternate with periods of I/O wait – a CPU-bound process – an I/O bound process 1
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 2
Goals of Scheduling 3
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) 4
Scheduling in Batch Systems (2) Three level scheduling 5
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 6
Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes Static and dynamic priority allocations, e. g. 1/f. 7
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 8
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 9
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 10
Thread Scheduling (1) Possible scheduling of user-level threads • 50 -msec process quantum, threads run 5 msec/CPU burst Application-specific thread schedulers 11
Thread Scheduling (2) Possible scheduling of kernel-level threads • 50 -msec process quantum • threads run 5 msec/CPU burst 12
UNIX Scheduler The UNIX scheduler is based on a multilevel queue structure 13
Scheduling in Windows (1) Mapping of Win 32 priorities to Windows 2000 priorities 14
Scheduling in Windows (2) Windows 2000 supports 32 priorities for threads 15
- Slides: 15