unix process management
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 processesTRANSCRIPT
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
Presentation on 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
Presentation on Process Management
By: Arshad RumanEmail Id: [email protected]
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
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
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
Process States
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
Interaction Of Processes
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
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
Representation of Process Scheduling
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
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
Addition of Medium Term Scheduling
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
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
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
Processes Tree on a UNIX System
E-mail: [email protected]; http://www.wavedigitech.com Phone : 91-963289173
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
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
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
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
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
© 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