CPU Scheduling 2
CPU Scheduling 2
In Priority Scheduling,
Advantages-
Disadvantages-
Important Notes-
Note-01:
The waiting time for the process having the highest priority
will always be zero in preemptive mode.
The waiting time for the process having the highest priority
may not be zero in non-preemptive mode.
Note-02:
Priority scheduling in preemptive and non-preemptive mode
behaves exactly same under following conditions-
Problem-01:
Consider the set of 5 processes whose arrival time and burst time
are given below-
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
Solution-
Gantt Chart-
Now, we know-
Turn
Process
Exit time Around Waiting time
Id
time
P1 4 4–0=4 4–4=0
P2 15 15 – 1 = 14 14 – 3 = 11
P3 12 12 – 2 = 10 10 – 1 = 9
P4 9 9–3=6 6–5=1
P5 11 11 – 4 = 7 7–2=5
Now,
Problem-02:
Consider the set of 5 processes whose arrival time and burst time
are given below-
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
Solution-
Gantt Chart-
Now, we know-
P1 15 15 – 0 = 15 15 – 4 = 11
P2 12 12 – 1 = 11 11 – 3 = 8
P3 3 3–2=1 1–1=0
P4 8 8–3=5 5–5=0
P5 10 10 – 4 = 6 6–2=4
Now,