# Shortest job first scheduling

Shortest job first scheduling
Key concept of this algorithm is: “CPU is allocated to the process with least CPU-burst time.” Amongst the processes in the ready queue. CPU is always assigned to the process with least CPU burst requirement. If the two processes having the same length, next CPU burst, fcfs scheduling is used i.e. one which arrives first, will be taken up first by the CPU.

This algorithm can be preemptive or non-preemptive.

Let us consider, the following set of processes having their CPU burst time mentioned in millisecond and having arrived almost at the same time.

 process CPU Burst Time p1 10 p2 5 p3 2

The Gantt chart:

shortest job first scheduling

Waiting time for P3 = 0 millisecond
Waiting time for P2= 2 millisecond
Waiting time for P1 = 7 millisecond
Average waiting time= (0+2+7) /3 = 3 millisecond

Related posts:

1. Round robin scheduling Round Robin Scheduling The basic purpose of this algorithm is...
2. First Come First Served Algorithm First come first served scheduling algorithm (FCFS) FCFS also termed...
3. Scheduling Introduction Scheduling is the process of determining which processes will...
4. Processes Scheduling queue As processes enter the system they put in job queue....
5. Process States As the program executes, it generally changes state. A state...