# Recent past more heavily weighted priority priority

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ority Scheduling A priority number (integer) is associated with each process The The CPU is allocated to the process with the highest priority (smallest integer ≡ highest priority). SJF is a priority scheduling where priority is the predicted next CPU burst time. Problem with priorities? Round Round Robin (RR) Each process gets a small unit of CPU time (time quantum), e.g. 10100 100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time time units. Performance • q large ~ scheduling algorithm? • q small problems? Example: Example: RR with Time Quantum = 20 Process P1 P2 P3 P4 The Gantt chart is: P1 0 P2 20 37 P3 Burst Time 53 17 68 24 P4 57 P1 77 P3 97 117 P4 P1 P3 P3 121 134 154 162 Compare to SJF: avg turnaround time and response Typically, higher average turnaround than SJF, but better response. How How a Smaller Time Quantum Increases Context Switches Turnaround Turnaround Time Varies With The Time Quantum ^ quanta: response? Policy Policy versus Mechanism Separate what from how • priority scheduling mechanism, how to set priorities => policy • RR mechanism, how to set quanta => policy Other Examples? 15 Multilevel Queue Multilevel Queue Scheduling Ready queue is partitioned into separate queues, e.g.: foreground (interactive) – I/O bound background (batch) – CPU-bound Each queue has its own scheduling algorithm, e.g. foreground – RR – why? background – FCFS Scheduling must be done between the queues. • Fixed priority scheduling; i.e., serve all from foreground then from background. Problem? • Time slice – each queue gets a certain amount of CPU time which it can schedule amongst its processes; e.g., 80% to foreground jobs in RR 20% to background jobs in FCFS Multilevel Multilevel Queue Scheduling Multilevel Multilevel Feedback Queue A process can move between the various queues; aging can be be implemented this way. Feedback -> move bet. queu...
View Full Document

## This document was uploaded on 04/02/2014.

Ask a homework question - tutors are online