More Process Management
When men willingly suspend fear, science flourishes.
— Anonymous
6.1 Introduction
Chapter 5 discusses the concurrent execution abstraction and processes of execu-
tion. The chapter explains how an operating system stores information about processes
in a table, and how each process is assigned a state. Chapter 5 also explains the con-
cepts of scheduling and context switching. It shows how a scheduler implements a
scheduling policy, and explains how a process moves between the ready and current
This chapter extends our study of process management. The chapter explains how
a new process comes into existence, and what happens when a process exits. The
chapter also examines a process state that allows a process to be suspended temporarily,
and explores functions that move processes among the current, ready, and suspended
6.2 Process Suspension And Resumption
We will see that operating system functions sometimes need to temporarily stop a
process from executing and at a later time resume execution. We say that a stopped
process has been placed in a state of “suspended animation.” Suspended animation can
be used, for example, when a process waits for one of several restart conditions without
knowing which will occur first.
90 More Process Management Chap. 6
The first step in implementing operating system functionality consists of defining a
set of operations. In the case of suspended animation, only two conceptual operations
provide all the functionality that is needed:
Suspend stops a process and places the process in suspended ani-
mation (i.e., makes the process ineligible to use the CPU).
Resume continues execution of a previously suspended process
(i.e., makes the process eligible to use the CPU again).
Because it is not eligible to use the CPU, a suspended process cannot remain in ei-
ther the ready or current states. Thus, a new state must be invented. We call the new
state suspended, and add the new state and associated transitions to the state diagram.
Figure 6.1 shows the extended state diagram, which summarizes how suspend and
resume affect the state. The resulting diagram documents the possible transitions
among the ready, current, and suspended states.
Figure 6.1 Transitions among the current, ready, and suspended states.
6.3 Self-Suspension And Information Hiding
Although each state transition in Figure 6.1 has a label that specifies a particular
function, process suspension differs from scheduling in a significant way: instead of act-
ing on the current process, suspend allows one process to suspend another process.
More important, because a suspended process cannot resume itself, resume must allow
an executing process to resume a previously suspended process. Thus, suspend and
resume each take an argument that specifies the ID of a process on which the operation
should be performed.
Can a process suspend itself? Yes. To do so, a process must obtain its process ID
and then pass the ID as an argument to suspend. An implementation may seem obvi-
ous. Because global variable currpid contains the process ID of the currently executing
process, a self-suspension can be achieved with:

Get Operating System Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.