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 upper level has an absolute priority over lower levels then it is non-preemptive else if 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 starvation problem.
2. Priority Scheduling Algorithm :
Priority scheduling algorithm executes processes depending upon their priority. Each process is allocated a priority and process with highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by system depending upon number of resources required, time needed, etc. whereas external priorities are based upon time in which work is needed or amount being paid for work done or importance of process. Priority scheduling can be preemptive or non-preemptive.
- If two processes have same priority then tie is broken using FCFS.
- The waiting time for highest priority process is always zero in preemptive mode while it may not be zero in case of non-preemptive mode.
The major problem is starvation or indefinite blocking. It may so happen that in stream of processes, system keeps executing high priority processes and low priority processes never get executed.
Difference between MLQ and Priority Scheduling Algorithm :
|S.No.||Multi level queue scheduling (MLQ)||Priority scheduling|
|1.||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.||It executes processes based upon their priorities i.e. in descending order of their priorities. A process with higher priority is executed first.|
|2.||It can be both non-preemptive and preemptive in nature depending upon conditions.||It is both preemptive and non preemptive in nature.|
|3.||Average waiting time and average response time depends upon algorithms used in various levels of multi level queue for scheduling.||There is no idea of average waiting time and response time.|
|4.||It leads to starvation of processes at lower levels of multi-level queue.||The problem of blocking of a process can be solved through aging which means to gradually increase priority of a process after a fixed interval of time by a fixed number.|
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.