Open In App

SJF Full Form

SJF stands for Shortest Job First. It is a type of CPU scheduling. This algorithm associate with each process the length of the latter’s next CPU burst. When the CPU is available, it is assigned to the process that has the smallest next CPU burst time. It is a scheduling policy that selects for executing the waiting process with the smallest execution time. If two processes have the same length next CPU burst, First Come will be executed.



Characteristics

Example:

Here, we are given 4 processes P1, P2, P3, and P4 and their burst time is 6, 8, 7, 3 respectively.
Let us assume they all arrive at the same time.
By definition of SJF scheduling, we can say that P4 will execute first, then P1, then P3, and at last P2 will execute.



Gantt chart will be:-

The waiting time is 3 unit time for process P1, 16 unit time for process P2, 9 unit time for process P3, and 0 unit time for process P4.
Hence average waiting time is (3 + 16 + 9 + 0)/4 = 7 unit time.

Advantages

Disadvantages

Article Tags :