When using Priority Preemptive Scheduling, does a higher priority yield way to a process with a lower priority but with a shorter burst time?
For example, if I had:
Arrival Time Burst Time Priority
P1 0 5 3
P2 2 6 1
P3 3 3 2
Would the Gannt chart look like this?
| P1 | P2 | P3 | P1 |
0 2 8 11 16
Priority Scheduling always selects the process(es) with the highest priority currently ready to run. If there is more than one process having the currently highest priority, you need a second scheduling algorithm to choose among these processes. Non-preemptive Priority Scheduling only selects a new process to run if the running process finished its work or yields (voluntarily) to the scheduler.
Preemptive Priority Scheduling is the same algorithm but if a new process having a higher priority than the currently running process arrives, it gets selected immediately. The new process has not to wait until the currently running process finishes or yields.
In your sample, the Gantt chart for Preemptive Priority Scheduling and 3 being the highest and 1 the lowest priority would look like:
| P1 | P3 | P2 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
| p1 | p2 | p3 | p1 |
0....2....8....11...14
taking 1 as the highest priority.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With