Process Description and Control. Process concepts n Definitions – replaces task, job – program...
-
Upload
elwin-gordon -
Category
Documents
-
view
216 -
download
4
Transcript of Process Description and Control. Process concepts n Definitions – replaces task, job – program...
Process Description and Control
Process concepts Definitions
– replaces task, job– program in execution– entity that can be assigned to and executed on a processor
Process states– running– ready– blocked
The main responsibility of an OS is to control the execution of processes
OS objectives and processes Operating systems must interleave the execution of a number of processes
– to maximize processor use– while providing reasonable response rate
Operating systems must allocate resources to processes
– based on priorities– while avoiding deadlock
Operating systems may support– interprocess communications– user creation of processes
A two-state process model
Enter
Dispatch
Exit
Pause
Notrunning
Running
Process creation– new batch job– interactive login– OS created to provide a
service– spawned by existing
process
Process termination– normal completion– abnormal end
(abend) time related protection error program error data error I/O failure memory error
Process state transitions with suspend and resume
Running
Blocked
Ready
Suspended blocked
Suspended ready
I/O or event completion
Suspend
Resume
Suspend
Resume
Suspend
I/O or event completion
Dispatch
Timer-runout
I/O or event wait
ACT IVE
SWAPPED
Other related concepts Suspend and swapping
– not immediately available– may or may not be waiting for event or I/O
– blocked may be independent of suspend
– process was placed on suspend by an agent
OS and processes– the OS schedules and dispatches processes for execution by the processor, and allocates resources to processes
– OS is the entity that manages the use of system resources by processes
OS control structures What does the OS needs (a) to be able to control processes and (b) manage resources for them?
– memory tables– I/O tables– file tables– process tables
These tables are maintained by the OS
How does it know what and how to create?
– Initialization and configuration
Process control structures What is the physical manifestation of a process?
– a program or set of programs – a set of data locations for variables and constants
– memory to hold programs and data– stack for procedure calls, parameter passing
PCB - Process Control Block– entity that defines a process to the OS
– collection of process attributes: process identification, processor state and process control information.
OS core, kernel or supervisor Execution modes: system or user modes
OS core or kernel– Process management
process creation and terminationprocess scheduling and dispatching
process switchingprocess synchronization and support for inter-process communication
management of PCBs– Memory management– I/O management– Support functions
Is the Operating System a process?
Process switching
U1 . . . .
. . .
.U2 U3 Un O1 O2 O3 On
P1
P2
P3
. . .
.Kernel
Pn
Process switching
OS OS OS OS. . . .
P1
P2
P3
Pn
1. No,separate
2.No, subroutines
3. Yes
Processes and Threads Process is a unit of:
– resource ownership– dispatching
Threads– only an unit of dispatching– inside a process– saves time to create, switch and terminate
A good example: a file server process
– each request as a thread– the process spawn the threads