# Non-preemptive Shortest Job First Scheduling Algorithm

Q3. Explain Non-preemptive Shortest Job First Scheduling with example.

Ans. Once CPU is given to the process it cannot be preempted until completes its CPU burst.

Let’s take four processes that arrive at the same time in this order:

Process               CPU Time Needed (ms)

P1                         6

P2                         8

P3                         7

P4                         3

Gantt Chart:

 P4 P1 P3 P2

0                    3                       9                                        16                                                 24

P1’ waiting time=3

P2’s waiting time=16

P3’s waiting time=9

P4’s waiting time=0

Average Waiting Time

=(3+16+9+0)/4

=28/4

=7 milliseconds

Turnaround Time

Turnaround Time = Burst Time + Waiting Time

Process             Turnaround Time

P1                       6+3=9

P2                       8+16=24

P3                       7+9=16

P4                       3+0=3

Average Turnaround Time

=(9+24+16+3)/4

=13 milliseconds

112 Views