Given the following table :

I want to calculate the average waiting time of preemptive priority scheduling .
In the table above , the bigger the number is (in the priority column) the higher the priority is .
Partial solution :
|p1|p3|p1|p2|p5|p4|
0 8 29 33 52 67 80
What do I do from here ?
Thanks
did you understand the partial solution (the actual schedule) you have posted?
Waiting time of a process = finish time of that process - execution time - arrival timeOnce you have this for all process then just take the average. That would give you the avg waiting time of the scheduling algorithm for this instance
More details:
Here process
p1did not wait for the first 8 seconds. Then at t=9 it was preempted. It was in wait mode from time t=9 to t=29 while processp3was executing. Sop1had waited for 21 seconds whilep3was executing. At t=29,p1started again and completed at t=33. In total,p1had waited for 21 seconds. As per the formula we get waiting time as 33-12-0=21. Basically for each process we look at the time between when it arrived and when it finished. Any time between this interval when it is not executing is a wait time