How to calculate Average Waiting Time and average Turn-around time in SJF Scheduling?

Failed_Noob picture Failed_Noob · Mar 18, 2012 · Viewed 264.9k times · Source

In SJF (Shortest Job First) Scheduling method.

enter image description here

How to calculate Average Waiting Time and average Turn-around time?

Is Gannt Chart correct ?

enter image description here

Answer

Hifzan picture Hifzan · Apr 18, 2012

Gantt chart is wrong... First process P3 has arrived so it will execute first. Since the burst time of P3 is 3sec after the completion of P3, processes P2,P4, and P5 has been arrived. Among P2,P4, and P5 the shortest burst time is 1sec for P2, so P2 will execute next. Then P4 and P5. At last P1 will be executed.

Gantt chart for this ques will be:

| P3 | P2 | P4 | P5 | P1 |

1    4    5    7   11   14

Average waiting time=(0+2+2+3+3)/5=2

Average Turnaround time=(3+3+4+7+6)/5=4.6