Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 8

PRIORITY SCHEDULING

Types of priority scheduling:

 Preemptive priority scheduling

 Non- preemptive priority scheduling


As an example:

Process Arrival time Burst time (in Priority


(in ms) ms)
P1 0 11 2
P2 2 1 3
P3 3 4 2
P4 4 2 1

Using non-preepmtive priority scheduling, we schedule these processes


according to following Gantt Chart -

P1 P4 P3 P2
0 11 13 17 18

Average waiting time = {0 + (17-2) + (13-3) + (11-4)} /4 = 8 ms


Using preepmtive priority scheduling, we schedule these processes
according to following Gantt Chart -

P1 P4 P1 P3 P2
0 4 6 13 17 18

Average waiting time = {(6-4)+(17-2)+(13-3)+(11-4)} /4


= 6.75 ms
 Indefinite blockage – A major problem
of priority scheduling

 Aging – Its solution


ROUND – ROBIN SCHEDULING

- A preemptive scheduling
As an example:

Process Burst time (in


ms)
P1 4
Time quantum = 3 ms
P2 2
P3 6
P4 1

Using round – robin (RR) scheduling, we schedule these processes


according to following Gantt Chart -

P1 P4 P3 P2

Average waiting time = {(9-3) + 3 + (10-5) + 8} /4 = 5.5 ms


References:
Operating System Concepts 7th_ed,Silberschatz,Galvin

You might also like