1. Longest Job First (LJF) :
It CPU Scheduling algorithm where the process with the largest burst line is executed first. Once the process enters the ready queue, the process exits only after the completion of execution, therefore it is a non-preemptive process. In case, the burst times of the processes are same, the job with overall lowest time is selected. This CPU scheduling algorithm results in low throughput of the system.
| Process | AT | BT |
|---|---|---|
| 1 | 0 | 3 |
| 2 | 1 | 2 |
| 3 | 2 | 4 |
| 4 | 3 | 5 |
| 5 | 4 | 6 |

2. Longest Remaining Job First (LRJF) :
It is the preemptive version of Longest Job First CPU Scheduling Algorithm. The process Burst Time are chosen at every second and then the longest job is selected. In case, the Burst Time of the processes are same, the job with overall low arrival time is selected.
It suffers from starvation, because of simultaneous checking of processes’ remaining Burst Time. It is also called “Longest Remaining Time First” algorithm.
| Process | AT | BT |
|---|---|---|
| 1 | 0 | 3 |
| 2 | 1 | 2 |
| 3 | 2 | 4 |
| 4 | 3 | 5 |
| 5 | 4 | 6 |

Difference between LJF and LRJF CPU scheduling algorithms :
| LJF | LRJF |
|---|---|
| Non preemptive | Preemptive |
| It suffers from starvation | It also suffers from starvation |
| Waiting Time is high | Waiting Time is not so high, and processes get chances for execution after some interval. |
| Switching context is less, since a process that once enters running state is executed completely. | Switching context is more, since the process are continually checked for execution. |
| The processes are executed based on their CPU time and arrival time alone, without increasing CPU overload. | The processes are repeatedly checking for an idle CPU, thereby increasing the overload. |
| No process can complete its execution until longest job persists. | The processes can complete execution before the longest process. |
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Recommended Posts:
- Difference between SRJF and LRJF CPU scheduling algorithms
- Difference between SJF and LJF CPU scheduling algorithms
- Difference between First Come First Served (FCFS) and Longest Job First (LJF) CPU scheduling algorithms
- Longest Job First (LJF) CPU scheduling algorithm
- Difference between Longest Job First (LJF) and Round Robin (RR) scheduling algorithms
- Difference between Priority Scheduling and Longest Job First (LJF)
- Difference between Multi Level Queue Scheduling (MLQ) and Longest Job First (LJF)
- Difference between Priority Scheduling and Round Robin (RR) CPU scheduling
- Difference between Priority scheduling and Shortest Job First (SJF) CPU scheduling
- Multilevel Feedback Queue Scheduling (MLFQ) CPU Scheduling
- Difference between Preemptive Priority based and Non-preemptive Priority based CPU scheduling algorithms
- Difference between Preemptive and Non-preemptive CPU scheduling algorithms
- Difference between FCFS and SJF CPU scheduling algorithms
- Difference between SJF and SRJF CPU scheduling algorithms
- Difference between EDF and LST CPU scheduling algorithms
- Difference between Multilevel Queue (MLQ) and Multi Level Feedback Queue (MLFQ) CPU scheduling algorithms
- Difference between Turn Around Time (TAT) and Waiting Time (WT) in CPU Scheduling
- Difference between Arrival Time and Burst Time in CPU Scheduling
- Difference between FCFS and Priority CPU scheduling
- Advantages and Disadvantages of various CPU scheduling algorithms
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

