unix process management

25
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173 Presentation on Unix Process Management

Upload: wave-digitech

Post on 22-May-2015

1.371 views

Category:

Technology


0 download

DESCRIPTION

Unix Process Management Process management is an integral part of any modern day operating system (OS). The OS must allocate resources to processes, enable processes to share and exchange information, protect the resources of each process from other processes and enable synchronisation among processes

TRANSCRIPT

Page 1: Unix Process management

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Presentation on Unix Process Management

Page 2: Unix Process management

© Copyright 2013, wavedigitech.com.

Latest update: June 15, 2013,http://www.wavedigitech.com/

Call us on : : 91-963289173E-Mail : [email protected]

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 3: Unix Process management

Presentation on Process Management

By: Arshad RumanEmail Id: [email protected]

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 4: Unix Process management

Contents

1.Process Concept:2.Process Scheduling:3.Operations On Process:4.Cooperating Process:5.Inter Process Communication:

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 5: Unix Process management

Process Concept

Classes:

Batch Processing(60’s)

Multiprogramming(70’s)

Time Sharing(70’s)

Real Time(80’s)

Distributed(90’s)

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 6: Unix Process management

OS Performs following Actions While creating Process:

Assign Process Id and PriorityAllocating Memory and other resourcesSet up the Process environmentCreating PCBReturn Process Id

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 7: Unix Process management

Process States

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 8: Unix Process management

Process Control Block(PCB)

Process IDPriorityProcess State

PSWCPU registerEvent InformationMemory AllocationResource HeldPCB Pointer

Process Scheduling Information

PSW & CPU reg information

Info for which process is waiting

Pointer to another PCB

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 9: Unix Process management

Interaction Of Processes

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 10: Unix Process management

Process Scheduling Queues

Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device. Process migration between the various queues

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 11: Unix Process management

Scheduling

Activity of SELECTING the next request to be handled by SERVER. Two fundamental Techniques:

1: Pre-emption Of Request2:Reordering Of Request

Linux Process:

1: Normal or Real Time

2: Priority

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 12: Unix Process management

Representation of Process Scheduling

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 13: Unix Process management

Four Events Of Scheduler

1: Arrival:

A request is arrived to system.

2:Scheduling:

Scheduler selects one request for servicing.

3:Pre-emption:

Request is Preempted to service other request.

4:Completion:

Process request gets completed.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 14: Unix Process management

Schedulers

Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue.

Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 15: Unix Process management

Addition of Medium Term Scheduling

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 16: Unix Process management

Context Switch

When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process.

Context-switch time is overhead; the system does no useful work while switching.

Time dependent on hardware support.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 17: Unix Process management

Process Creation

Parent process create children processes, which, in turn create other processes, forming a tree of processes.

Resource sharing

✦ Parent and children share all resources.

✦ Children share subset of parent’s resources.

✦ Child will not exceed resource limits on that process.

Execution

✦ Parent and children execute concurrently.

✦ Parent waits until children terminate.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 18: Unix Process management

Process Creation (Cont.)

Address space

✦ Child duplicate of parent.

✦ Child has a program loaded into it.

UNIX examples

✦ fork system call creates new process

✦ exec system call used after a fork to replace the process’ memory space with a new program.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 19: Unix Process management

Processes Tree on a UNIX System

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 20: Unix Process management

Process Termination

Process executes last statement and asks the operating

system to decide it (exit).

✦ Output data from child to parent (via wait).

✦ Process’ resources are deallocated by operating system. Parent may terminate execution of children processes (abort).

✦ Child has exceeded allocated resources.

✦ Task assigned to child is no longer required.

✦ Parent is exiting.Operating system does not allow child to continue if its parent terminates. Cascading termination.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 21: Unix Process management

Cooperating Processes

Independent process cannot affect or be affected by the execution of another process. Cooperating process can affect or be affected by the execution of another process.

Advantages of process cooperation

✦ Information sharing

✦ Computation speed-up

✦ Modularity

✦ ConvenienceE-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 22: Unix Process management

Producer-Consumer Problem

Paradigm for cooperating processes, producer process produces information that is consumed by a consumer process.

✦ unbounded-buffer places no practical limit on the size of the buffer.

✦ bounded-buffer assumes that there is a fixed buffer size.

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 23: Unix Process management

Interprocess Communication (IPC)

Mechanism for processes to communicate and tosynchronize their actions.

Message system – processes communicate with eachother without resorting to shared variables.

IPC facility provides two operations:

✦ send(message) – message size fixed or variable

✦ receive(message) If P and Q wish to communicate, they need to:

✦ establish a communication link between them

✦ exchange messages via send/receive Implementation of communication link

✦ physical (e.g., shared memory, hardware bus)

✦ logical (e.g., logical properties)

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 24: Unix Process management

Shared data

#define BUFFER_SIZE 10

Typedef struct {

. . .

} item;

item buffer[BUFFER_SIZE];

int in = 0;

int out = 0;

Solution is correct, but can only use BUFFER_SIZE-1

elements

Bounded-Buffer – Shared-Memory Solution

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173

Page 25: Unix Process management

© Copyright 2013, wavedigitech.com.

Latest update: June 27, 2013,http://www.wavedigitech.com/

Call us on : : 91-963289173E-Mail : [email protected]

Thank You

E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173