Longest Job First LJF Scheduling Algorithm
For Complete YouTube Video: Click Here
In this class, we will try to understand Longest Job First LJF Scheduling Algorithm.
In our previous class, we discussed the concept of the Shortest Job First.
Longest Job First LJF Scheduling Algorithm
The longest job first scheduling algorithm will select the process with the longest execution or burst time for execution.
Longest Job First LJF Scheduling Algorithm is a non-preemptive algorithm.
To understand this, we will consider the example shown below.
The same examples we have considered in our previous concepts also.
At arrival time 0, we have only one process, P1 so we will select P1 for execution.
So P1 will get executed for two units in time.
Below is the Gantt chart for the analysis of the above example.
After completing two units in time, we have processes P1, P2, and P3 in the ready state.
Process P1 has done its execution, and we have P2 and P3 for execution.
Among those two processes, P2 has the longest execution time, so that P2 will get executed.
After P2’s execution, all the processes arrived in the ready pool.
Among all the remaining processes, P4 has the longest burst time P4 is chosen for execution.
Next, P5 will get executed, and after that, P3 will complete its execution.
Based on the Gantt chart, we will find the completion, turnaround, and waiting time for all the processes as shown below.