Chapter 3
Chapter 3
Process Description
and Control
Operating Systems: Internals
and Design Principles
The concept of process is fundamental to the structure of
modern computer operating systems. Its evolution in
analyzing problems of synchronization, deadlock, and
scheduling in operating systems has been a major
intellectual contribution of computer science.
Program code
Which may be shared with other processes that are
executing the same program
identifier
program
state priority
counter
Trace Dispatcher
of Figure
3.2
Figure 3.3
Combined
Traces of
Processes
of Figure
3.2
Two-State Process Model
Process Parent
Child process
spawning process
• when the OS • is the • is the new
creates a original, process
process at creating,
the 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 or 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 to
make room for a new process, or a previously
suspended process that is now ready to execute
• Commonly used in systems that had no virtual
memory; less likely to be used with virtual memory
since process
size can be controlled through the
paging mechanism.
One Suspend State
Two Suspend States
Characteristics of a Suspended
Process
• The process is not • The process may or
immediately available may not be waiting on
for execution an event
• Information
may be
maintained
These tables provide information about:
and used by
a file • existence of files
management • location on secondary memory
system, or • current status
the OS itself • other attributes
Process Tables
• Must be maintained to manage processes
• Process tables must have some reference to
memory, I/O, and file tables
• e.g., pointers from each individual process entry to its
data in the other three sets of tables.
• The tables themselves must be accessible
by the OS and therefore are subject to
memory management
• Processes are represented by a process
image
Process Control Structures-PCB
Process Components Process Attributes
• more-privileged
• less-privileged mode
mode • also referred to as
• user programs control mode or
typically execute in kernel mode
this mode • kernel of the
operating system
Table 3.7
Typical
Functions
of an
Operating
System
Kernel
Process Creation
• Once the OS decides to create a new process it:
Interrupt Trap
• Due to some sort of event • An error or exception
that is external to and condition generated within
independent of the the currently running
currently running process process
• clock interrupt • OS determines if the
• I/O interrupt condition is fatal
• memory fault • moved to the Exit state
• Time slice and a process switch
occurs
• the maximum amount of
time that a process can • action will depend on the
execute before being nature of the error
interrupted
Mode Switching
Classes: Categories: