Difference between Multi Level Queue Scheduling (MLQ) and Shortest Job First
1. Multi Level Queue Scheduling (MLQ) :
It is quite difficult to have just one queue and schedule all the processes. This is where multi level queue scheduling is used. In this the processes are divided into various classes depending upon the property of the processes such as system process, I/O process etc. Thus we get ‘n’ number of queues for n classes of processes. Each queue is assigned a priority and can use its own scheduling algorithm which makes it convenient to use many scheduling algorithms at the same time. Generally the topmost level of queue has the highest priority which decreases as we move to the lower levels. If the upper level has an absolute priority over lower levels then it is non preemptive else if the time slice is divided between various queues then it becomes preemptive in nature.
- Advantages –
The major advantage of this algorithm is that we can use various algorithms such as FCFS, SSJF, LJF, etc. At the same time in different queues.
- Disadvantages –
The lowest level processes suffer from starvation problem.
2. Shortest Job First (SJF) :
It 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 least 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 Shortest Remaining Time First (SRTF) algorithm.
The major advantage of this algorithm is that it gives the minimum waiting time for a given set of processes and thus reduces the average waiting time. The disadvantage of this algorithm is that long processes may never be processed by the system and may remain in the queue for very long time leading to starvation of processes.
If two processes have same burst time then the tie is broken using FCFS, i.e., the process that arrived first is processed first.
Difference between SJF and Multi Level Queue Scheduling :
|Shortest Job First (SJF)
||Multi Level Queue Scheduling (MLQ)
|SJF is also non-preemptive but its preemptive version is also there called Shortest Remaining Time First (SRTF) algorithm.
||MLQ can be non-preemptive or preemptive depending on the conditions.
|It executes the processes in descending order of their burst time i.e. shortest job is executed first.
||Processes are executed depending on the priority of that particular level of queue to which the process belongs. Further selection of process is based upon the type of algorithm used in that particular queue.
|The overhead in SJF is due to the fact that time elapsed has to be recorded.
||MLQ has some CPU overhead as it needs to switch between the queues.
|Average waiting time is minimal in case of SJF.
||Average waiting time depends upon the algorithms used in various levels of queues.
|The major difficulty in its implementation is that length of next CPU burst is unknown.
||It is complex algorithm and is difficult to implement.
|It leads to starvation of processes which have very large burst times.
||It leads to the starvation of processes at lower levels.
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.