Javatpoint Logo
Javatpoint Logo

Multilevel Queue Scheduling in Operating System

In this article, you will learn about multilevel queue scheduling and the several types of processes in the multilevel queue in the OS.

Multilevel Queue Scheduling

Each algorithm supports a different process, but in a general system, some processes require scheduling using a priority algorithm. While some processes want to stay in the system (interactive processes), others are background processes whose execution can be delayed.

The number of ready queue algorithms between queues and within queues may differ between systems. A round-robin method with various time quantum is typically utilized for such maintenance. Several types of scheduling algorithms are designed for circumstances where the processes can be readily separated into groups. There are two sorts of processes that require different scheduling algorithms because they have varying response times and resource requirements. The foreground (interactive) and background processes (batch process) are distinguished. Background processes take priority over foreground processes.

The ready queue has been partitioned into seven different queues using the multilevel queue scheduling technique. These processes are assigned to one queue based on their priority, such as memory size, process priority, or type. The method for scheduling each queue is different. Some queues are utilized for the foreground process, while others are used for the background process. The foreground queue may be scheduled using a round-robin method, and the background queue can be scheduled using an FCFS strategy.

Advantages and Disadvantages of Multilevel Queue Scheduling

There are various advantages and disadvantages of multilevel queue scheduling. Some of the advantages and disadvantages of the multilevel queue scheduling are as follows:

Advantages

  1. You can use multilevel queue scheduling to apply different scheduling methods to distinct processes.
  2. It will have low overhead in terms of scheduling.

Disadvantages

  1. There is a risk of starvation for lower priority processes.
  2. It is rigid in nature.

Example

Let's take an example of a multilevel queue-scheduling algorithm with five queues to understand how this scheduling works:

Multilevel Queue Scheduling in Operating System
  1. System process
  2. Interactive processes
  3. Interactive editing processes
  4. Batch processes
  5. Student processes

Every queue would have an absolute priority over the low-priority queues. No process may execute until the high-priority queues are empty. In the above instance, no other process may execute until and unless the queues for system, interactive, and editing processes are empty. If an interactive editing process enters the ready queue while a batch process is underway, the batch process will be preempted.

There are the descriptions of the processes that are used in the above example:

System Process

The OS has its process to execute, which is referred to as the System Process.

Interactive Process

It is a process in which the same type of interaction should occur.

Batch Process

Batch processing is an operating system feature that collects programs and data into a batch before processing starts.

Student Process

The system process is always given the highest priority, whereas the student processes are always given the lowest.

Example Problem

Let's take an example of a multilevel queue-scheduling (MQS) algorithm that shows how the multilevel queue scheduling work. Consider the four processes listed in the table below under multilevel queue scheduling. The queue number denotes the process's queue.

Process Arrival Time CPU Burst Time Queue Number
P1 0 4 1
P2 0 3 1
P3 0 8 2
P4 10 5 4

Queue 1 has a higher priority than queue 2. Round Robin is used in queue 1 (Time Quantum = 2), while FCFS is used in queue 2.

Multilevel Queue Scheduling in Operating System

Working:

  1. Both queues have been processed at the start. Therefore, queue 1 (P1, P2) runs first (due to greater priority) in a round-robin way and finishes after 7 units.
  2. The process in queue 2 (Process P3) starts running (since there is no process in queue 1), but while it is executing, P4 enters queue 1 and interrupts P3, and then P3 takes the CPU and finishes its execution.

Multilevel Feedback Scheduling

Each algorithm supports a different process, but some processes require scheduling using a priority algorithm in a general system. There is a different queue for foreground or background operations, but they do not switch between queues or change their foreground or background nature; this type of organization benefits from low scheduling but is inflexible.

This strategy prioritizes operations that require I/O and are interactive. It is a distinct process with a distinct CPU burst time. It enables a process to switch between queues. If a process consumes too much processor time, it will be switched to the lowest priority queue. A process waiting in a lower priority queue for too long may be shifted to a higher priority queue. This type of aging prevents starvation.

The parameters of the multilevel feedback queue scheduler are as follows:

  1. The scheduling algorithm for every queue in the system.
  2. The queues number in the system.
  3. The method for determining when a queue should be demoted to a lower-priority queue.
  4. When a process is upgraded to a higher-priority queue, this process determines when it gets upgraded.
  5. The method for determining which processes will enter the queue and when those processes will require service






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA