0
votes
Process     Burst Time     Arrival Time     Priority
P1          5              0                1
P2          1              0                3
P3          2              2                1
P4          4              4                2
P5          2              4                2
P6          3              5                3
P7          4              5                3

Hi guys. We're given an assignment about Preemptive Priority Scheduling and I really don't know how to do this given two or more processes having the same priority number.

I have to make a gantt chart, compute turn-around time, and average waiting time.

If possible, can you guys post a step-by-step solution on how to do it so that I can study how it's done.

Thanks for the help guys.

1
If this is a conceptual question, it would be better suited for Software Engineering or possibly [theoretical.se].GraphicsMuncher

1 Answers

1
votes

Firstly: two processes with the same priority will generally be sorted according to their arrival time: so first come first serve.

Turn around time: generally refers to the amount of time required for the process to produce output. Your course may use a different or simpler definition to make your calculations easier. From what I can see you are probably being asked to compute the amount of time it takes for each process to complete. This is equal to: finish_time - time_first_scheduled_on_CPU (not finish_time - arrival_time).

Average waiting time: Based on the Gantt chart you develop which shows exactly when and for how long a process is on the CPU, you can compute the total amount of time each process was waiting to get on the CPU.

This consists of:

  1. Amount of time between arrival and when it is first scheduled on the CPU
  2. If the process has a longer execution time than a single quantum then you need to sum all of the time spent off the CPU
  3. Add the two quantities together and you have the total waiting time for the process
  4. Repeat steps 1-3 for each process and take the average.