1. Multi Level Queue Scheduling (MLQ) :
It is quite difficult to have just one queue and schedule all processes. This is where multi-level queue scheduling is used. In this, processes are divided into various classes depending upon property of 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, topmost level of queue has highest priority which decreases as we move to 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, SJF, LJF, etc. At the same time in different queues.
- Disadvantages –
The lowest level processes suffer from the starvation problem.
2. Longest Job First (LJF) :
Longest Job First is a non-preemptive scheduling algorithm. This algorithm is based upon burst time of processes. The processes are put into ready queue based on their burst times i.e., in descending order of burst times. As the name suggests this algorithm is based upon fact that process with largest burst time is processed first. The burst time of only those processes is considered that have arrived in system until that time. Its preemptive version is called Longest Remaining Time First (LRTF) algorithm.
If two processes have the same burst time then tie is broken using FCFS i.e., process that arrived first is processed first.
- This algorithm gives very high average waiting time and average turn-around time for a given set of processes.
- This may lead to convoy effect.
- It may happen that a short process may never get executed and system keeps on executing longer processes.
- It reduces processing speed and thus reduces efficiency and utilisation of system.
Difference between Longest Job First (LJF) and Multi Level Queue Scheduling (MLQ) :
|S.NO.||Longest Job First (LJF)||Multi Level Queue (MLQ)|
|1.||It executes processes based upon their burst time i.e. in descending order of their burst times.||Processes are executed depending on priority of that particular level of queue to which process belongs. Further selection of process is based upon type of algorithm used in that particular queue.|
|2.||It is non-preemptive but its preemptive version is also there called Shortest Remaining Time First (SRTF) algorithm.||It can be both preemptive and non preemptive in nature depending upon conditions.|
|3.||The average waiting time for given set of processes is quite long which reduces effectiveness of system.||There is no idea of average waiting time and response time as it completely depends upon algorithms used in various levels of multi-level queue.|
|4.||A long process may never get executed and system may keep executing short processes.||It leads to starvation of processes at lower levels of multi level queue.|
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.