110 likes | 131 Views
Process Description and Control. 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. Process concepts.
E N D
Process Description and Control
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 Process concepts
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 OS objectives and processes
Dispatch A two-state process model Exit Enter Not running Running Pause • Process termination • normal completion • abnormal end (abend) • time related • protection error • program error • data error • I/O failure • memory error • Process creation • new batch job • interactive login • OS created to provide a service • spawned by existing process
Process state transitions with suspend and resume I/O or event completion A C T I V E Blocked Dispatch Ready I/O or event wait Timer- runout Running Suspend Resume Resume Suspend Suspended blocked Suspend Suspended ready SWAPPED I/O or event completion
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 Other related concepts
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
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. Process control structures
Execution modes: system or user modes • OS core or kernel • Process management • process creation and termination • process scheduling and dispatching • process switching • process synchronization and support for inter-process communication • management of PCBs • Memory management • I/O management • Support functions OS core, kernel or supervisor
Is the Operating System a process? 1. No, separate . . . . P1 P2 P3 Pn Kernel P1 Pn P3 P2 . . . . 2.No, subroutines OS OS OS OS Process switching . . . . . . . . U1 On U2 U3 O1 O2 O3 Un 3. Yes Process switching
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