Operating System - Shortest Job First(SJF) Scheduling

<<Previous

Next >>





  • 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:


ProcessCPU-Burst Time
p120
p24
p33

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.


ProcessArrival TimeCPU-Burst Time
p1020
p214
p333

Gantt Chart:




<<Previous

Next >>