CH 04-1 - OS8e-Process Description and Control
CH 04-1 - OS8e-Process Description and Control
CH 04-1 - OS8e-Process Description and Control
Architecture
and
Operating
Chapter 4-1
Systems Process Description
and Control
Eighth Edition
By William Stallings
OS Management of
Application Execution
Resources are made available to multiple
applications
Theprocessor is switched among multiple
applications so all will appear to be
progressing
Theprocessor and I/O devices can be
used efficiently
Process Elements
Two essential elements of a process are:
Program code
which may be shared with other processes that are executing
the same program
identifier
program
state priority
counter
Context data
Process
Dispatcher
5000
Execution 8000
Process A
Process B
12000
Process C
Dispatch
Pause
Queue
Enter Dispatch Exit
Processor
Pause
Table 3.2 Time limit exceeded The process has run longer than the specified total time limit. There are a
number of possibilities for the type of time that is measured. These include total
elapsed time ("wall clock time"), amount of time spent executing, and, in the
case of an interactive process, the amount of time since the user last provided
any input.
Reasons for Memory unavailable The process requires more memory than the system can provide.
Protection error
The process tries to access a memory location that it is not allowed to access.
The process attempts to use a resource such as a file that it is not allowed to use,
Arithmetic error The process tries a prohibited computation, such as division by zero, or tries to
store numbers larger than the hardware can accommodate.
Time overrun The process has waited longer than a specified maximum for a certain event to
occur.
I/O failure An error occurs during input or output, such as inability to find a file, failure to
read or write after a specified maximum number of tries (when, for example, a
defective area is encountered on a tape), or invalid operation (such as reading
from the line printer).
Invalid instruction The process attempts to execute a nonexistent instruction (often a result of
branching into a data area and attempting to execute the data).
Privileged instruction The process attempts to use an instruction reserved for the operating system.
Operator or OS intervention For some reason, the operator or the operating system has terminated the process
(e.g., if a deadlock exists).
Parent termination When a parent terminates, the operating system may automatically terminate all
of the offspring of that parent.
(Table is located on page 115 Parent request A parent process typically has the authority to terminate any of its offspring.
in the textbook)
Five-State Process Model
Dispatch
Admit Release
New Ready Running Exit
Timeout
Event
Occurs Event
Wait
Blocked
Process B
Process C
Dispatcher
0 5 10 15 20 25 30 35 40 45 50
Timeout
Blocked Queue
Event Event Wait
Occurs
(a) Single blocked queue
Timeout
Event 1 Queue
Event 1 Event 1 Wait
Occurs
Event 2 Queue
Event 2 Event 2 Wait
Occurs
Event n Queue
Event n Event n Wait
Occurs
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
(a) With One Suspend State
New
Ad
t
Dispatch
mi
Admit Release
mi
Ad
New Ready Suspend Running Exit
t
Timeout
Activate Dispatch
Ready/ Release
it
Ready Running Exit
Occurs Occurs
a
e
Event Event
at
tW
Suspend
iv
Suspend Timeout
ct
t W ven
A
t
ai
Occurs
Event
Suspend
en
Suspend Blocked
Ev
Activate
Blocked/
Suspend (a)Blocked
With One Suspend State
Suspend
mi
Ad
Suspe
t
nd
(a) With One Suspend State
New
Ad
t
mi
mi
Ad
Suspe
t
nd
Activate Dispatch
Ready/ Release
Suspend Ready Running Exit
Suspend Timeout
t
ai
Occurs
Occurs
Event
Event
tW
en
Ev
Activate
Blocked/
Suspend
Blocked
Suspend
Computer
Resources
Main
Processor I/O I/O I/O
Memory
Figure 3.10 Processes and Resources (resource allocation at one snapshot in time)
Process
Image
Memory Tables
Process
Memory 1
Files
Process 1
Process 2
Process
Process 3 Image
Process
n
Process n
current status
Information may be maintained and used by a file management system
inwhich
other attributes
case the OS has little or no knowledge of files
User Data
The modifiable part of the user space. May include program data, a user stack area, and
programs that may be modified.
User Program
The program to be executed.
Stack
Each process has one or more last-in-first-out (LIFO) stacks associated with it. A stack is
used to store parameters and calling addresses for procedure and system calls.
Stack Pointers
Each process has one or more last-in-first-out (LIFO) system stacks associated with it. A stack is used
to store parameters and calling addresses for procedure and system calls. The stack pointer points to
(Table is located
the top of the stack. on page 129 in the
textbook)
Process Control Information
Table 3.5
ready, waiting, halted).
Priority: One or more fields may be used to describe the scheduling priority of the process. In
some systems, several values are required (e.g., default, current, highest-allowable)
Scheduling-related information: This will depend on the scheduling algorithm used. Examples
are the amount of time that the process has been waiting and the amount of time that the process
executed the last time it was running. Typical
Event: Identity of event the process is awaiting before it can be resumed.
Data Structuring
A process may be linked to other process in a queue, ring, or some other structure. For example, all
Elements of a
processes in a waiting state for a particular priority level may be linked in a queue. A process may
Process
exhibit a parent-child (creator-created) relationship with another process. The process control block
may contain pointers to other processes to support these structures.
Interprocess Communication
Various flags, signals, and messages may be associated with communication between two
independent processes. Some or all of this information may be maintained in the process control Control Block
block.
Memory Management
This section may include pointers to segment and/or page tables that describe the virtual memory
assigned to this process.
Ready
Blocked
Support Functions
Interrupt handling
Accounting
Monitoring
Once the OS decides to create a new process it:
assigns a unique process identifier
to the new process
Kernel
Operating P1 P2 Pn
System
OS OS OS
Func- Func- Func-
tions tions tions
P1 P2 Pn OS1 OSk
Execution Within
Process Control
Information
Private User
Address Space
(Programs, Data)
Kernel Stack
Shared Address
Space
Process description
Operating system control structures
Process control structures