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.
The lowest level processes suffer from starvation problem.
2. Round-Robin (RR) :
It 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.
Difference between MLQ and Round-Robin (RR) scheduling algorithm :
|MLQ executes the process depending upon the priority if the level of queue in which the process resides and further execution is dependent upon the algorithm used in that level.||Round-Robin (RR) executes the processes based upon the time quantum defined i.e. each process is executed for a fixed amount of time.|
|MLQ can be both non preemptive and preemptive depending upon the conditions.||Round-Robin (RR) is preemptive in nature.|
|The average waiting time for given set of processes is dependent upon the tupe of algorithms used in various levels of multi level queue.||The average waiting time for given set of processes is quite small and depends on the time quantum.|
|It is quite complex and difficult to implement.||It is quite easy to implement RR.|
|It leads to the starvation of processes at the lower levels.||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.|
|Switching between different levels causes overhead on the processor.||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.|
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.