Module 5: Process Scheduling
Introduction
The goal of any operating system is to make the best use of the computing resources available to
accomplish the mission of that operating system. Process scheduling is one of the more essential aspects
of accomplishing that goal. When we look at process scheduling, one size does not fit all — the
scheduling algorithms should be chosen with the mission of that particular operating system in mind. For
example, an operating system running primarily batch jobs would have a different slant on the scheduling
algorithms than an operating system running on a smart phone. For some, perhaps old or a simple new
operating system that holds only one process at a time, the scheduling of a 'job' might be a manual
process. In a highly interactive environment, many processes may need to be managed, and the speed of
bringing a process to the user on demand may be an important goal.
In modern operating systems, where many processes are being held by the system, a scheduler is
needed to select a process (or processes) to run and to decide how long it should run before selecting
another process. Also, if resources in the computer managed by the operating system become scarce,
what should the operating system do?
Scheduling Algorithms
Your text discusses various scheduling algorithms, but first they discuss the environments we would need
to consider. Let's summarize them here:
• Batch
• Interactive
• Real-time
Each of these have some distinct goals for scheduling algorithms, described on page 158 of your text; be
sure to be familiar with these goals. Also, in each of these systems, there are well-known scheduling
algorithms. Let's summarize them here, too:
• Batch
o First-Come, First-Served
o Shortest Job First
o Shortest Remaining Time Next
• Interactive Systems
o Round-Robin Scheduling
o Priority Scheduling
o Multiple Queues
o Shortest Process Next
o Guaranteed Scheduling
o Lottery Scheduling
o Fair-Share Scheduling
• Real-Time Systems
o Hard Real Time
o Soft Real Time
As you are reading the text, keep in mind the categories in which the scheduling algorithms are
described. Some of these algorithms obviously have some overlap — for example; the batch-oriented
"Shortest Job First" and "Shortest Remaining Time Next" are similar to the Interactive System's "Shortest
Process Next". It is interesting to note that these scheduling algorithms are more theoretical than practical
— to actually implement these usually requires knowing the future, unless the process that is running is
known to take a specific amount of time to execute (which may be more likely in some Batch jobs).
However, these algorithms can be approximated by observing the behavior of the process. Early in the
chapter Tanenbaum discusses "compute-bound" vs. "I/O bound" processes. "I/O Bound" processes are
more likely to execute for a short amount of time before blocking — in that sense you could consider a
process with this behavior to be a candidate for the "Shortest Remaining Time Next", since the process
historically doesn't execute for very long before it blocks.
One aspect not discussed in your text is Three-Level Scheduling (although it is covered in some other
versions of Tanenbaum’s text and in other references). This is commonly is discussed in the context of
batch systems, but the more common interactive systems we typically use actually have the same three
levels of scheduling present. The first level of scheduling, typically called the "Admission scheduler", is
actually analogous to a job scheduled by your system, say, nightly for backups, or a virus scan. In UNIX
systems, activities like this are sometimes called 'cron' jobs (named for the 'cron' command that
schedules these jobs). The second level, sometimes called the "Memory Scheduler" is analogous to the
"Swapper" which in UNIX systems might swap out an idle process to disk temporarily to free up memory
for other processes that are ready to run so they can execute more efficiently. We will talk more about the
"Memory Scheduler" when we discuss memory management in a future module. The last level of
scheduling is called the "CPU scheduler" is the actual process scheduler, which can be one of the
schedulers listed under "Interactive Systems" above.
Another point I would like to emphasize is the statement on page 161 where Tanenbaum says the
"Shortest Job First is provably optimal". Recall that there are many goals to process scheduling, so to
which of these goals is this algorithm is provably optimal? There are three goals stated for batch systems
— throughput, turnaround time, and CPU utilization. What Tanenbaum does not state clearly is that it is
provably optimal with the second of these goals, mean turnaround time. It doesn't really affect CPU
Utilization, or throughput, if you look at throughput as jobs/hour.
Tanenbaum also discusses priority scheduling in the reading for this module. In the last module,
Tanenbaum discussed 'priority-inversion' in the context of synchronization. However, that discussion
really fits a bit better here, since it would be the scheduling algorithm which would have to deal with this
issue. View the short presentation in the module content that explains priority inversion, both from the
context of busy waits (as described in your text), and from the context of blocking waits. This video
expands on the discussion in section 2.4.10 in your text.