Process Description and Control: Operating Systems: Internals and Design Principles
Process Description and Control: Operating Systems: Internals and Design Principles
Systems:
Internals
and Design Chapter 3
Principles Process Description
and Control
Seventh Edition
By William Stallings
Operating Systems:
Internals and Design Principles
Program code
• which may be shared with other processes that are executing the
same program
identifier
program
state priority
counter
Figure 3.3
Combined
Trace of
Processes of
Figure
3.2
Figure 3.4
Two-State Process Model
A process may be in one of two states:
running
not-running
Queuing Diagram
Table 3.1 Reasons for Process Creation
Process Creation
Process Parent
spawning Child process
process
• when the OS • is the • is the new
creates a original, process
process at the creating,
explicit process
request of
another
process
Process Termination
There must be a means for a process to indicate its
completion
A batch job should include a HALT instruction or an
explicit OS service call for termination
For an interactive application, the action of the user will
indicate when the process is completed (e.g. log off,
quitting an application)
Table 3.2
Reasons
for Process
Termination
Five-State Process Model
Process States for Trace of Figure 3.4
Using Two Queues
Multiple
Blocked
Queues
Suspended Processes
Swapping
involves moving part of all of a process from main memory to disk
when none of the processes in main memory is in the Ready state, the OS
swaps one of the blocked processes out on to disk into a suspend queue
One Suspend State
Two Suspend States
Characteristics of a
Suspended Process
The process is not The process may or may
immediately available for not be waiting on an
execution event
To manage
• where the
and process is located
control a • the attributes of
process the process that
the OS are necessary for
its management
must
know:
Process Control Structures
Process Location Process Attributes
A process must include a program Each process has associated with
or set of programs to be executed it a number of attributes that are
used by the OS for process control
A process will consist of at least
sufficient memory to hold the The collection of program, data,
programs and data of that process stack, and attributes is referred to
as the process image
The execution of a program
typically involves a stack that is Process image location will
used to keep track of procedure depend on the memory
calls and parameter passing management scheme being used
between procedures
Typical Elements of a Process Image
Process Attributes
Process Identification
Memory tables may be organized
Each process is assigned a unique to provide a map of main memory
numeric identifier with an indication of which process
otherwise there must be a is assigned to each region
mapping that allows the OS to similar references will appear in
locate the appropriate tables I/O and file tables
based on the process identifier
When processes communicate with
Many of the tables controlled by one another, the process identifier
the OS may use process identifiers informs the OS of the destination
to cross-reference process tables of a particular communication
Pentium
EFLAGS
Register
Bits
Process Control
Information
The additional information needed by the OS to
control and coordinate the various active processes
Typical
Elements
of a Process
Control Block
Structure of Process
Images in Virtual Memory
Process List Structures
Role of the
Process Control Block
The most important data structure in an OS
contains all of the information about a process that is needed by the OS
blocks are read and/or modified by virtually every module in the OS
defines the state of the OS
Typical
Functions
of an
Operating
System
Kernel
Process Creation
Once the OS decides to create a new process it:
assigns a unique process identifier to the
new process