0% found this document useful (0 votes)
20 views33 pages

Chapter03 p1

Uploaded by

musabrown0329
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views33 pages

Chapter03 p1

Uploaded by

musabrown0329
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Operating

Systems:
Internals
and Design Chapter 3
Principles Process Description
and Control
BALOYI VR
OS Management of
Application Execution
 Resources are made available
 Processor is switched
 Processor and I/O devices
Process Elements
 Two essential elements of a process are:

Program code

A set of data associated with that code


 While the program is executing, this process can be uniquely
characterized by a number of elements, including:

identifier

program
state priority
counter

memory I/O status accounting


context data
pointers information information
Process Control
Block
Contains the process elements
It is possible to interrupt a
running process and later resume
execution as if the interruption
had not occurred

Created and managed by the


operating system

Key tool that allows support for


multiple processes
Process States
Trace Dispatcher

the behavior of an
individual process small program
by listing the that switches the
sequence of processor from
instructions that one process to
execute for that another
process

the behavior of the processor


can be characterized by
showing how the traces of
the various processes are
interleaved
Process
Execution
Traces of
 Each process runs to completion
Processes
of
Figure 3.2

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
spawning Parent process Child process

• when the • is the • is the new


OS 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
Using Two Queues
Multiple
Blocked
Queues
 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
 The process is not  The process may or may
immediately available not be waiting on an
for execution event

 The process was placed  The process may not be


in a suspended state by removed from this state
an agent: either itself, a until the agent explicitly
parent process, or the orders the removal
OS, for the purpose of
preventing its execution
Reasons for Process Suspension

Table 3.3 Reasons for Process Suspension


Processes and Resources
OS
Control
Tables
 Used to keep track of both
main and secondary Must include:
memory
allocation of main memory to
 Maintained on secondary processes
memory using some sort
allocation of secondary
of virtual memory or memory to processes
simple swapping
protection attributes of blocks
mechanism of main or virtual memory

information needed to manage


virtual memory
 Used by the OS to manage If an I/O operation is in
the I/O devices and progress, the OS needs to
channels of the computer know:
system
the status of the I/O
 At any given time, an I/O operation
device may be available or
assigned to a particular
process the location in main
memory being used as the
source or destination of
the I/O transfer
These tables provide information
• existence of files about:
• location on secondary memory
• current status
• other attributes
 Must be maintained to manage processes
 Theremust be some reference to memory,
I/O, and files, directly or indirectly
 Thetables themselves must be accessible by
the OS and therefore are subject to memory
management
• located
Manage
and • attributes
control
Process Location Process Attributes
 A process must include a  Each process has associated with
program or set of programs to be it a number of attributes that are
executed 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 stack, and attributes is referred to
process as the process image
 The execution of a program  Process image location will
typically involves a stack that is depend on the memory
used to keep track of procedure management scheme being used
calls and parameter passing
between procedures
Process Attributes
 Memory tables may be
 Each process is assigned a organized to provide a map of
unique numeric identifier main memory with an indication
of which process is assigned to
 otherwise there must be a each region
mapping that allows the OS  similar references will appear in
to locate the appropriate I/O and file tables
tables based on the process
identifier  When processes communicate
with one another, the process
identifier informs the OS of the
 Many of the tables controlled by destination of a particular
the OS may use process communication
identifiers to cross-reference
process tables  When processes are allowed to
create other processes,
identifiers indicate the parent
and descendents of each
process

You might also like