Scheduling Algorithms
Scheduling Algorithms
Scheduling Algorithms
● Priority Scheduling
P0 0-0=0
P1 5-1=4
P2 8-2=6
P3 16 - 3 = 13
P0 0 5 0
P1 1 3 5
P2 2 8 14
P3 3 6 8
Gantt Chart
P1 P0 P3 P2
0 3 8 14 22
P0 0-0=0
P1 5-1=4
P2 14 - 2 = 12
P3 8-3=5
● Processes with same priority are executed on first come first served basis.
P0 0 5 1 0
P1 1 3 2 11
P2 2 8 1 14
P3 3 6 3 5
Gantt Chart
P0 P2 P1 P3
0 5 13 16 22
P0 0-0=0
P1 11 - 1 = 10
P2 14 - 2 = 12
P3 5-3=2
● Once a process is executed for a given time period, it is preempted and other
process executes for a given time period.
P0 0 5 1 0
P1 1 3 2 11
P2 2 8 1 14
P3 3 6 3 5
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P3 (9 - 3) + (17 - 12) = 11