Log in from a computer to take this course

You'll need to log in from a computer to start Fundamentals of Operating Systems. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

Multiple-level queue scheduling is an algorithm that attempts to categorize processes before placing them in a relevant prioritized subsection of the ready queue. In the example to the right, the middle subsection of the ready queue, also called a level, contains IO-bound tasks while the other levels contain higher and lower-priority CPU-bound tasks. This categorization allows higher-priority CPU-bound tasks to be executed before IO-bound tasks, while the IO-bound tasks are in turn able to be run before lower-priority CPU-bound tasks.

Tasks are executed one at a time by level, such that all of the processes in the topmost level are executed first before moving on to lower levels. If a process is placed at a higher level while a lower-level one is being processed, the scheduler will temporarily move back up to take care of the higher-level task first. For example, if the scheduler was focusing on executing the CPU-bound processes while an IO-bound process was added to the ready queue, the scheduler would preempt and prioritize completing this new IO-bound process before returning to finish the CPU-bound tasks. Processes also do not move between levels. This can cause starvation if the scheduler never processes a lower level.

Each level can also have its own scheduling algorithm. In the example to the right, the top, high-priority level uses round robin, while the middle IO level uses first come, first served to best account for possible resource blocks. The bottom, low-priority level is left with shortest job first to organize longer-running background tasks. This mixing of different algorithms attempts to combine the best qualities of each. However, this also creates intense complexity as there are many independently moving parts.

Instructions

To the right is an example animation for Multiple-level Queues Scheduling. Processes are categorized into different levels, each with different scheduling algorithms.

The topmost level uses Round Robin scheduling to run each process for the given time slice of 2 seconds. The following, middle level uses First Come, First Served scheduling to execute processes with the earliest arrival times first. The final, bottom level uses Shortest Job First Scheduling to prioritize processes with the shortest execution time. Each of these levels largely emulate the previous examples.

Some highlights of the prioritization inherent to the multiple-level structure are the addition of new processes to the Ready Queue throughout the animation.

When P13 and P14 are added to the topmost level while the middle, IO level is being executed, the usual prioritization of that level is interrupted. Executing upper-level processes is always done before executing processes on the lower levels. A similar occurrence happens when P15, P16, and P17 are added to the ready queue while the bottom, low-priority processes are being executed.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?