Open In App

Multilevel Feedback Queue Scheduling (MLFQ) CPU Scheduling

Multilevel Feedback Queue Scheduling (MLFQ) CPU Scheduling is like Multilevel Queue(MLQ) Scheduling but in this process can move between the queues. And thus, much more efficient than multilevel queue scheduling. 

Characteristics of Multilevel Feedback Queue Scheduling:

Features of Multilevel Feedback Queue Scheduling (MLFQ) CPU Scheduling:

Multiple queues: Similar to MLQ scheduling, MLFQ scheduling divides processes into multiple queues based on their priority levels. However, unlike MLQ scheduling, processes can move between queues based on their behavior and needs.

Priorities adjusted dynamically: The priority of a process can be adjusted dynamically based on its behavior, such as how much CPU time it has used or how often it has been blocked. Higher-priority processes are given more CPU time and lower-priority processes are given less.

Time-slicing: Each queue is assigned a time quantum or time slice, which determines how much CPU time a process in that queue is allowed to use before it is preempted and moved to a lower priority queue.

Feedback mechanism: MLFQ scheduling uses a feedback mechanism to adjust the priority of a process based on its behavior over time. For example, if a process in a lower-priority queue uses up its time slice, it may be moved to a higher-priority queue to ensure it gets more CPU time.

Preemption: Preemption is allowed in MLFQ scheduling, meaning that a higher-priority process can preempt a lower-priority process to ensure it gets the CPU time it needs.

Advantages of Multilevel Feedback Queue Scheduling:

Disadvantages of Multilevel Feedback Queue Scheduling:

Multilevel feedback queue scheduling, however, allows a process to move between queues. Multilevel Feedback Queue Scheduling (MLFQ) keeps analyzing the behavior (time of execution) of processes and according to which it changes its priority. 

Now, look at the diagram and explanation below to understand it properly.

Now let us suppose that queues 1 and 2 follow round robin with time quantum 4 and 8 respectively and queue 3 follow FCFS.

Implementation of MFQS is given below – 

Well, the above implementation may differ for example the last queue can also follow Round-robin Scheduling. 

Problems in the above implementation: A process in the lower priority queue can suffer from starvation due to some short processes taking all the CPU time. 

Solution: A simple solution can be to boost the priority of all the processes after regular intervals and place them all in the highest priority queue. 

What is the need for such complex Scheduling? 

Example: Consider a system that has a CPU-bound process, which requires a burst time of 40 seconds. The multilevel Feed Back Queue scheduling algorithm is used and the queue time quantum ‘2’ seconds and in each level it is incremented by ‘5’ seconds. Then how many times the process will be interrupted and in which queue the process will terminate the execution? 

Solution:

 

Article Tags :