Operating System - Shortest Job First(SJF) Scheduling
It allocates the CPU to the process which has the smallest CPU-bursts time.
Suppose, if the CPU bursts of two processes are the same, then we use FCFS scheduling to break the tie.
It gives minimum average waiting time.
It is used frequently in long-term scheduling but it cannot be implemented in short-term scheduling.
It can either be a preemptive or nonpreemptive.
Preemptive SJF scheduling is sometime called Shortest-remaining-time-first-Scheduling.
For example consider the set of processes that arrive at time 0 and CPU-burst time given in millisecond:
Following shows the Gantt Chart:
Suppose, the processes arrive in the different arrival time, then these processes will be served by using Preemtive SJF Scheduling.
|Process||Arrival Time||CPU-Burst Time|