Difference between Longest Job First (LJF) and Round Robin (RR) scheduling algorithms
1. Longest Job First (LJF) : Longest Job First (LJF) is based upon the burst time of the process. The processes are put into the ready queue based on their burst times. In this algorithm, the process with the largest burst time is processed first. The burst time of only those processes is compared that are present or have arrived until that time. It is also non-preemptive in nature. Its preemptive version is called Longest Remaining Time First (LRTF) algorithm. The major disadvantage of this algorithm is that it gives very high average waiting time and average turnaround time for a given set of processes and thus reduces the effectiveness of the system. It may also lead to the convoy effect.
Note: If two processes have same burst time then the tie is broken using FCFS, i.e., the process that arrived first is processed first.
2.Round-Robin (RR) : Round-Robin (RR) Scheduling Algorithm is particularly designed for time sharing systems. The processes are put into the ready queue which is a circular queue in this case. In this case a small unit of time known as time quantum is defined. The algorithm selects the first process from the queue and executes it for the time defined by the time quantum. If the process has burst time less than the time quantum then the CPU executes the next process but if it has burst time higher than the time quantum then the process is interrupted and next process is executed for same time quantum. If a process is interrupted then a context switch happens and the process is put back at the tail of the queue. It is preemptive in nature. This algorithm mainly depends on the time quantum. Very large time quantum makes RR same as the FCFS while a very small time quantum will lead to the overhead as context switch will happen again and again after very small intervals. The major advantage of this algorithm is that all processes get executed one after the other which does not lead to starvation of processes or waiting by process for quite long time to get executed.
The difference between Longest Job First (LJF) and Round-Robin (RR) scheduling algorithm are as follows:
|Longest Job First (LJF)
|Longest Job First (LJF) executes the processes based upon their burst time i.e. in descending order of their burst times.
||Round-Robin (RR) executes the processes based upon the time quantum defined i.e. each process is executed for a fixed amount of time.
|LJF is also non-preemptive but its preemptive version is also there called Longest Remaining Time First (LRTF) algorithm.
||Round-Robin (RR) is preemptive in nature.
|The average waiting time and average turn-around time for given set of processes is very large.
||The average waiting time for given set of processes is quite small and depends on the time quantum.
|The LJF algorithm is difficult to implement.
||It is quite easy to implement RR.
|A short process may never get executed and the system may keep executing the longer processes and a user may feel that his work is being neglected in case of multi user systems.
||Each process is executed and every user feels that his work is being done as the CPU gives equal amount of time to each process.
|In case of LJF, very large waiting time leads to slow processing and reduces the effectiveness of the system.
||In case of RR, if the time quantum is very small then context switch takes place again and again after very short intervals of time which leads to overhead.
|It suffers from starvation.
||It does not suffer from starvation.
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI
as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.