Multilevel Queue MLQ CPU Scheduling

What is Multilevel Queue Scheduling?

In multilevel queue scheduling, all the processes are assigned permanently to the queue at the time of entry. Processes will not move between queues and it may happen that the processes in the queue can be divided into different classes where classes have their own scheduling. For example, interactive process and batch process.

The main advantage of multilevel queue scheduling is that the processes are permanently assigned to the queue.

For example let’s take three different processes:

  1. System process
  2. Interactive process
  3. Batch process

  1. In system processes the CPU itself has their own process to run which is called system process.
  2. In an interactive process there should be the same type of interaction.
  3. Batch processing is a technique of the operating system which collects the programs and data in the form of a batch before the starting of the process.

Advantages of Multilevel Queue Scheduling:

  • As MLQ assigns permanent queue to the processes therefore, it has an advantage of low scheduling overhead.
  • We can use MLQ to apply different scheduling methods to distinct processes.

Disadvantages of MQL Scheduling:

  • Some processes may face starvation as higher priority queues are never becoming empty.
  • MQL is inexorable in nature.

Let’s take an explain of MLQ which shows how MQL Scheduling works

As we saw in the above table Queue 1 has higher priority then Queue and the Round Robin is used in Queue 1 ( Time Quantum=2) while first come first serve is used in Queue 2.

Lets see the GANT CHART:

Working:
Both the queues are procesed from the Start. Therefore, queues (P1, P2) runs first (because of greater priority) in a Round Robin way 1 finished after 7 units.

The process in Queue 2 (Process P3) starts running (as there is no process in queue 1) but while it is executing, P4 enter the queue 1 and interrupts P3, and then P3 takes the CPU and completes the execution.

This article tried to discuss the concept of Multilevel Queue MLQ CPU Scheduling. Hope this blog helps you understand the concept. To practice problems you can check out MYCODE | Competitive Programming – Heaps at Prepbytes

Leave a Reply

Your email address will not be published. Required fields are marked *