Process Description and Control. Process concepts n Definitions – replaces task, job – program...

11
Process Description and Control

Transcript of Process Description and Control. Process concepts n Definitions – replaces task, job – program...

Page 1: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

Process Description and Control

Page 2: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 3: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 4: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 5: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 6: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 7: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 8: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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.

Page 9: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 10: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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

Page 11: Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.

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