Multilevel feedback queue
In computer science, a multilevel feedback queue is a scheduling algorithm. Scheduling algorithms are designed to have some process running at all times to keep the central processing unit busy. The multilevel feedback queue extends standard algorithms with the following design requirements:
- Separate processes into multiple ready queues based on their need for the processor.
- Give preference to processes with short CPU bursts.
- Give preference to processes with high I/O bursts.
Process scheduling
Whereas the multilevel queue algorithm keeps processes permanently assigned to their initial queue assignments, the multilevel feedback queue shifts processes between queues. The shift is dependent upon the CPU bursts of prior time-slices.- If a process uses too much CPU time, it will be moved to a lower-priority queue.
- If a process is I/O-bound or an interactive process, it will be moved to a higher-priority queue.
- If a process is waiting too long in a low-priority queue and starving, it will be aged to a higher-priority queue.
Algorithm
Multiple FIFO queues are used and the operation is as follows:- A new process is inserted at the end of the top-level FIFO queue.
- At some stage the process reaches the head of the queue and is assigned the CPU.
- If the process is completed within the time slice of the given queue, it leaves the system.
- If the process voluntarily relinquishes control of the CPU, it leaves the queuing network, and when the process becomes ready again it is inserted at the tail of the same queue which it relinquished earlier.
- If the process uses all the quantum time, it is pre-empted and inserted at the end of the next lower-level queue. This next lower-level queue will have a time quantum that is more than that of the previous higher-level queue.
- This scheme will continue until the process completes or it reaches the base-level queue.
Also, a new process is always inserted at the tail of the top-level queue with the assumption that it will complete in a short amount of time. Long processes will automatically sink to lower-level queues based on their time consumption and interactivity level. In the multilevel feedback queue a process is given just one chance to complete at a given queue level before it is forced down to a lower-level queue.
Scheduling parameters
In general, a multilevel feedback queue scheduler is defined by the following parameters:- The number of queues.
- The scheduling algorithm for each queue which can be different from FIFO.
- The method used to determine when to promote a process to a higher priority queue.
- The method used to determine when to demote a process to a lower-priority queue.
- The method used to determine which queue a process will enter when that process needs service.