0
3.3kviews
Consider the following set of processes, with the length of the CPU burst given in milliseconds

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. Draw Gantt chart that illustrate the execution of these processes using non-preemptive priority (a larger priority number implies a higher priority). enter image description here

1 Answer
1
228views

Priority Based (Non-Preemptive) Scheduling

  • All processes P1, P2, P3, P4, P5, arrived at the same time 0.
  • A larger priority number implies a higher priority means 4 is the highest priority and 1 is the lowest priority.
  • Processes with the same priority and with the same arrival time then the process with lower names is executed first.
  • Hence, here the process P1 executed first then the Process P4 executed despite having the same priorities.
  • Therefore, the processes executed in the following sequence in Priority Based (Non-preemptive) Scheduling

Turn Around Time = Process Completion Time – Process Arrival Time

Waiting time = Turn Around time – Burst time

Priority based

Process Burst Time Priority Completion Time Turn Around Time Waiting Time
P3 8 4 8 8 – 0 = 8 8 – 8 = 0
P5 5 3 13 13 – 0 =13 13 – 5 = 8
P1 2 2 15 15 – 0 = 15 15 – 2 = 13
P4 4 2 19 19 – 0 = 19 19 – 4 = 15
P2 1 1 20 20 – 0 = 20 20 – 1 = 19

Average Turn Around Time = (8 + 13 + 15 + 19 + 20)/5 = 15 ms

Average Waiting time = (0 + 8 + 13 + 15 + 19)/5 = 11 ms

Please log in to add an answer.