Top Banner
Outline • Process Management
28

Outline

Dec 31, 2015

Download

Documents

emery-burt

Outline. Process Management. Process Manager. Process manager creates the process abstraction It implements a software environment for processes to run Process manager consists of Basic algorithms and data structures to implement the process and resource abstractions Scheduling - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Outline

Outline

• Process Management

Page 2: Outline

04/19/23 COP4610 2

Process Manager

• Process manager creates the process abstraction – It implements a software environment for processes

to run

• Process manager consists of– Basic algorithms and data structures to implement

the process and resource abstractions– Scheduling– Process synchronization– A deadlock strategy– Protection strategy

Page 3: Outline

04/19/23 COP4610 3

Process Manager – cont.

Page 4: Outline

04/19/23 COP4610 4

Process Model

• A process consists of the following tangible elements– A program to define the behavior of the process– The data operated on by the process and the

results it produces– A set of resources– The process descriptor for the OS to keep track

of the process

Page 5: Outline

04/19/23 COP4610 5

Processes – cont.

Page 6: Outline

04/19/23 COP4610 6

Process Descriptor

• Process descriptor (also called process control block)– Is the data structure used by the process manager

to record the status of a process while the process manager algorithms monitor and control the process

Page 7: Outline

04/19/23 COP4610 7

Process Descriptor – cont.

• Process descriptor includes the following– Its processor registers contents at the time it was

last suspended– Its processor state– The address space mapping details– Its memory state– A pointer to its stack– The resources that have been allocated to it– The resources that it needs

Page 8: Outline

04/19/23 COP4610 8

Process Descriptor – cont.

Page 9: Outline

04/19/23 COP4610 9

Process State Diagram

Page 10: Outline

04/19/23 COP4610 10

Process State Diagram – cont.

• Process creation (new ready)– Create/find an available process descriptor entry– Assign a unique process ID– Define the address space that the process needs– Load the desired program into the address space– Initialize the data, stack, and resources available

to the process– Set the process’s state to ready and add to the

ready queue

Page 11: Outline

04/19/23 COP4610 11

Process State Diagram – cont.

• Ready list – set of all processes residing in main memory, ready and waiting to execute

• Ready Running– By the CPU scheduler– When the process is chosen to run next, the OS

restores the register values from the process descriptor, including PC and the process starts running again

Page 12: Outline

04/19/23 COP4610 12

Process State Diagram – cont.

• Context switch– When CPU is switched to another process, the

system must save the status of the old process and load the saved status for the new process

– Context switch time is overhead; the system does not do useful work while switching from application’s point of view

– Context switch time is hardware dependent; it can be a significant factor in CPU scheduling algorithm design

Page 13: Outline

04/19/23 COP4610 13

Process State Diagram – cont.

-How many context switches does it take for the

OS to switch from one user process to another?

Page 14: Outline

04/19/23 COP4610 14

Process State Diagram – cont.

• Running Blocked– When the resources requested by the process are

not available immediately, the process will be blocked, and its state will be changed from running to blocked and be removed from the ready list

Page 15: Outline

04/19/23 COP4610 15

Process State Diagram – cont.

• Running Ready– In a time-sharing system, when a process uses its

allowed time slice, it will be suspended by OS through a timer interrupt

– The process will be put back to the ready list and the scheduler will choose one among the ready processes

Page 16: Outline

04/19/23 COP4610 16

Process State Diagram – cont.

• Running Running– When the resources requested are available

immediately, the process allows to continue to run.

– This, however, depends on the scheduling algorithm implementation

Page 17: Outline

04/19/23 COP4610 17

Process State Diagram – cont.

• Running Terminated– When a process finishes, the OS will release the

resources allocated to the process– The process descriptor data structure will also be

released• However, it may not be done immediately

• In UNIX, the process descriptor is released after the parent has called “wait” system call to collect its status information

• If the process’s parent exits before it does, the process becomes a zombie

Page 18: Outline

04/19/23 COP4610 18

Process State Diagram – cont.

• Blocked Ready– When the resources requested by the process

become available, the process will be marked as ready and be put back into the ready list

Page 19: Outline

04/19/23 COP4610 19

Process Address Space

• Process address space– A set of locations used by a process to reference

primary memory locations, OS services, and resources

Page 20: Outline

04/19/23 COP4610 20

Process Address Space – cont.

Page 21: Outline

04/19/23 COP4610 21

Process Address Space – cont.

Page 22: Outline

04/19/23 COP4610 22

Process Hierarchy

Page 23: Outline

04/19/23 COP4610 23

Unix Process Hierarchy

Page 24: Outline

04/19/23 COP4610 24

Resource Manager

• Each resource type is associated with a resource manager– The resource manager is responsible for

allocating resources to processes and returning released resources

Page 25: Outline

04/19/23 COP4610 25

Resource Manager – cont.

Page 26: Outline

04/19/23 COP4610 26

Resource Manager – cont.

• Resource descriptor is to save the state of the resource type

Page 27: Outline

04/19/23 COP4610 27

Resource Manager – cont.

Page 28: Outline

04/19/23 COP4610 28

Resource Manager – cont.

• Reusable resources– Resources that can be allocated and must be

returned to the system after the process has finished using them

– Such as memory

• Consumable resources– Resources that can cause a process to be blocked

on request but are never released by that process– Such as input data