Shortest Job First Algorithm

Shortest Job First (SJF) is an algorithm in which the process having the smallest execution time is chosen for the next execution. This scheduling method can be preemptive or non-preemptive. It significantly reduces the average waiting time for other processes awaiting execution. The full form of SJF is Shortest Job First.

Characteristics

Advantages

Disadvantages

Example

Process Arrival Time Burst Time
P1 2 6
P2 5 2
P3 1 8
P4 0 3
P5 4 4

Working

Gantt Chart

P4 P1 P2 P5 P3
0 - 3 3 - 9 9- 11 11 - 15 15 - 23

Final Table

Process Arrival Time Burst Time Completion Time Turn Around Time Waiting Time Response Time
P1 2 6 9 7 1 1
P2 5 2 11 6 4 4
P3 1 8 23 22 14 14
P4 0 3 3 3 0 0
P5 4 4 15 11 7 7