7.OS Lecturer
7.OS Lecturer
The CPU is allocated to the process with the highest priority (smallest
integer highest priority)
• Preemptive
• Nonpreemptive
SJF is priority scheduling where priority is the inverse of predicted next
CPU burst time
Operating System Concepts – 10th Edition 5.1 Silberschatz, Galvin and Gagne ©2018
Example of Priority Scheduling
Operating System Concepts – 10th Edition 5.2 Silberschatz, Galvin and Gagne ©2018
Priority Scheduling
In the Example, there are 7 processes P1, P2, P3, P4, P5, P6 and P7.
Their priorities, Arrival Time and burst time are given in the table..
1 2 0 3
2 6 2 5
3 3 1 4
4 5 4 2
5 7 6 9
6 4 5 4
7 10 7 10
Operating System Concepts – 10th Edition 5.3 Silberschatz, Galvin and Gagne ©2018
Priority Scheduling…
Process Priority
Arrival Burst Complet Turnaro Waiting Respons
Id Time Time ion und Time e Time
Time TimeTime
1.Turn Around Time = Completion - Arrival Time
2.Waiting Time = Turn Around Time - Burst Time
1 2 0 3 3 3 0 0
2 6 2 5 18 16 11 13
3 3 1 4 7 6 2 3
4 5 4 2 13 9 7 11
5 7 6 9 27 21 12 18
6 4 5 4 11 6 2 7
7 10 7 10 37 30 18 27
Operating System Concepts – 10th Edition 5.4 Silberschatz, Galvin and Gagne ©2018
Priority Scheduling
In the Example, there are 7 processes P1, P2, P3, P4, P5, P6 and P7.
Their priorities, Arrival Time and burst time are given in the table..
1 2(L) 0 1
2 6 1 7
3 3 2 3
4 5 3 6
5 4 4 5
6 10(H) 5 15
7 9 15 8
Operating System Concepts – 10th Edition 5.5 Silberschatz, Galvin and Gagne ©2018
Priority Scheduling
1 2 0 1 1 1 0
2 6 1 7 22 21 14
3 3 2 3 5 3 0
4 5 3 6 16 13 7
5 4 4 5 10 6 1
6 10 5 15 45 40 25
7 9 6 8 30 24 16
Operating System Concepts – 10th Edition 5.6 Silberschatz, Galvin and Gagne ©2018
Multilevel Queue
The ready queue consists of multiple queues
Multilevel queue scheduler defined by the following parameters:
• Number of queues
• Scheduling algorithms for each queue
• Method used to determine which queue a process will enter
when that process needs service
• Scheduling among the queues
Operating System Concepts – 10th Edition 5.7 Silberschatz, Galvin and Gagne ©2018
Multilevel Queue
With priority scheduling, have separate queues for each priority.
Schedule the process in the highest-priority queue!
Operating System Concepts – 10th Edition 5.8 Silberschatz, Galvin and Gagne ©2018
Multilevel Queue
Prioritization based upon process type
Operating System Concepts – 10th Edition 5.9 Silberschatz, Galvin and Gagne ©2018
Multilevel Feedback Queue
A process can move between the various queues.
Multilevel-feedback-queue scheduler defined by the following
parameters:
• Number of queues
• Scheduling algorithms for each queue
• Method used to determine when to upgrade a process
• Method used to determine when to demote a process
• Method used to determine which queue a process will enter
when that process needs service
Aging can be implemented using multilevel feedback queue
Operating System Concepts – 10th Edition 5.10 Silberschatz, Galvin and Gagne ©2018
Example of Multilevel Feedback Queue
Three queues:
• Q0 – RR with time quantum 8 milliseconds
• Q1 – RR time quantum 16 milliseconds
• Q2 – FCFS
Scheduling
• A new process enters queue Q0 which is
served in RR
When it gains CPU, the process receives 8
milliseconds
If it does not finish in 8 milliseconds, the
process is moved to queue Q1
• At Q1 job is again served in RR and
receives 16 additional milliseconds
If it still does not complete, it is preempted
and moved to queue Q2
Operating System Concepts – 10th Edition 5.11 Silberschatz, Galvin and Gagne ©2018