1. Shortest remaining job first (SRJF) :
Shortest remaining job first also called the shortest remaining time first is the preemptive version of the shortest job first scheduling algorithm.
In the shortest remaining job first, the process with the smallest runtime to complete (i.e remaining time) is scheduled to run next, In SRJF, a running process will be preempted if a new process arrives in the CPU scheduler which requires less burst time for execution.
2. Longest remaining job first (LRJF) :
Longest remaining job first also called longest remaining time first is exactly opposite of SRJF. In this type of CPU scheduling, the process which has the longest processing time is scheduled to run next and a running process will be preempted if a new process with longer burst time enters the queue.
| Shortest Remaining Job First (SRJF) | Longest Remainig Job First(LRJF) |
|---|---|
| short processes are executed first and at any instant if a process with shorter time arrives it will be executed first. |
Long processes are executed first and at any instant of time if a long process appears it will be executed first. |
| It does not have large average turn around time therefore it is more effective than LFJT |
It has a very large average turn around time and waiting time therefore reduces the effectiveness of the operating system |
| It does not lead to convoy effect | It will lead to convoy effect. |
| More process are executed in less amount of time | Less process are executed in certain amount of time |
Let’s solve one problem for each:
| Processes | Arrival Time | Burst Time |
|---|---|---|
| P1 | 0 | 2 |
| P2 | 0 | 4 |
| P3 | 0 | 8 |
Longest remaining job first:
Gantt chart:

Therefore the final table will be:
| Processes | Arrival Time | Burst Time | Completion Time | Turn Around Time | Wating Time |
|---|---|---|---|---|---|
| P1 | 0 | 2 | 12 | 12 | 10 |
| P2 | 0 | 4 | 13 | 13 | 9 |
| P3 | 0 | 8 | 14 | 14 | 6 |
Turn around time = Completion time - Arrival time Average turn around time, = [(12-0) + (13-0) + (14-0)]/3 = (12 + 13 + 14)/3 = 13 Waiting time = Turn around time - Burst time Average waiting time, = [(12-2) + (13-4) + (14-8)]/3 = (10 + 9 + 6)/3 = 8.34
Problem two:
| Processes | Arrival Time | Burst Time |
|---|---|---|
| P1 | 0 | 20 |
| P2 | 15 | 25 |
| P3 | 30 | 10 |
| P4 | 45 | 15 |
Shortest remaining time first:
Gantt chart:

Therefore the final table will be:
| Processes | Arrival Time | Burst Time | Completion Time | Turn Around Time | Wating Time |
|---|---|---|---|---|---|
| P1 | 0 | 20 | 20 | 20 | 0 |
| P2 | 15 | 25 | 55 | 40 | 15 |
| P3 | 30 | 10 | 40 | 10 | 0 |
| P4 | 45 | 15 | 70 | 25 | 10 |
Turn around time = Completion time - Arrival time Average turn around time, = [(20-0) + (55-15) + (40-10) + (70-45)]/4 = (20 + 40 + 30 + 25)/4 = 28.75 Waiting time = Turn around time - Burst time Average waiting time, = [(20-20) + (40-25) + (10-10) + (25-15)] / 4 = (0 + 15 + 0 + 10) / 4 = 6.25
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 SJF and SRJF CPU scheduling algorithms
- Difference between LJF and LRJF CPU scheduling algorithms
- Difference between Preemptive Priority based and Non-preemptive Priority based CPU scheduling algorithms
- Difference between Preemptive and Non-preemptive CPU scheduling algorithms
- Difference between SJF and LJF 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
- Advantages and Disadvantages of various CPU scheduling algorithms
- Fair-share CPU scheduling
- Difference between SCAN and LOOK Disk scheduling algorithms
- Difference between FCFS and SCAN disk scheduling algorithms
- Difference between SCAN and CSCAN Disk scheduling algorithms
- Difference between Shortest Job First (SJF) and Round-Robin (RR) scheduling algorithms
- Difference between LOOK and C-LOOK Disk scheduling algorithms
- Difference between Seek Time and Rotational Latency in Disk Scheduling
- Difference between Seek Time and Disk Access Time in Disk Scheduling
- Difference between Seek Time and Transfer Time in Disk Scheduling
- Difference between Rotational Latency and Transfer Time in Disk Scheduling
- Difference between Transfer Time and Disk Access Time in Disk Scheduling
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.

