Operating system scheduling is the process of controlling and prioritizing messages sent to a processor. An internal operating system program, called the scheduler, performs this task. The goal is maintaining a constant amount of work for the processor, eliminating highs and lows in the workload and making sure each process is completed within a reasonable time frame. While scheduling is important to all systems, it is especially important in a real-time system.
Since nearly every operation on a computer has at least a small amount of processor time involved, the processor can be a major source of slowdowns and bottlenecks. In order to alleviate the strain on the processor, and make sure tasks are completed in a timely manner, most operating systems use some form of task scheduling. The operating system scheduling process varies based on the system, but they tend to fall within familiar categories.
Scheduling is typically broken down into three parts: long-, mid- and short-term scheduling. Not every operating system fully uses each type — midterm and long-term are often combined — but they will use some combination of them. Each type of scheduling provides a slightly different benefit to the system.
Long-term scheduling revolves around admitting programs to the scheduling process. When a new program initiates, the long-term scheduler determines if there is enough space for the new entrant. If there isn’t, then the scheduler delays the activation of the program until there is enough room.
The midterm scheduler decides which processes have been idle and which are active. It leaves the active processes alone and writes idle ones to the hard drive. This frees up memory for other programs to come in through the long-term scheduler. When the mid- and long-term schedulers are combined, instead of delaying activation of a new process, the scheduler simply swaps it into storage.
The short-term scheduler is the part that works directly with the processor. This portion activates processes, sets priorities and oversees the processor’s workload. The short-term scheduler is constantly trying to anticipate computer needs to keep the processor running smoothly.
In most circumstances, operating system scheduling is a way of making a computer function more efficiently, but in a real-time operating system, it is vital to its purpose. A real-time system needs to execute processes within a set time, and if these process lag, then their purpose is lost. These important programs require very specific system scheduling in order to make sure information and responses are where they need to be, when they need to be.