Lesson Two Process Management
Lesson Two Process Management
COMPILED BY:
EMAIL: [email protected]
FOLLOWING COURSES:
DCS,DBIT,DIT,DSE
PROCESS MANAGEMENT
A process can be thought as a program in execution. It needs certain resources including CPU time
The o/s is responsible for the following activities in connection with process management:
Process Model
A process is more than a program. It includes current activity temporary data containing global value. A
program is a passive entity e.g. contents of a file stored on disk where as a process is an entity.
Process state
As a process executes, it changes state. The state of a process is defined in part by the current activity of
INTER-PROCESS COMMUNICATION
O/s must provide inter-process communication facility (IPC) which provides a mechanism to allow
processes to communicate and to synchronize their actions to prevent Race conditions (a condition where
several processes access and manipulate the same data concurrently and the outcome of the execution
To guard against this mechanisms are necessary to ensure that only one process at a time can be
It is a segment of code in which a process may be changing common variables, updating a table, writing a
file etc. Each process has its critical section while the other portion is referred to as Reminder section.
The important feature of the system is that when one has process is executing in its critical section no
other process is to be allowed to execute its critical section. Each process must request permission to enter
i) Mutual Exclusion – If one process is executing its critical section then no other process can be
ii) Progress – If no process is executing in its critical section and there exists some processes that
wish to enter critical sections then those processes that are not executing in their remainder
i) Bounded Waiting – There must exist a bound on the number of times that other processes are
allowed to enter their critical sections after a process has made a request to enter its critical
Busy waiting occurs when one process is being executed in its critical section and process 2 tests
to confirm if process 1 is through. It is only acceptable technique when the anticipated waits are
1. Semaphores
The fundamental principle is this: 2 or more processes can operate by means of simple signals, such that a
process can be forced to stop at a specified place until it has received a special signal.
Any complex coordinative requirement can be satisfied by the appropriate structure of signals.
For signaling special variables called semaphores are used: To transmit a signal via semaphores, a process
executes the primitive wait P(s); if the corresponding signal V(s) has not yet been transmitted the process
To achieve the desired effect we can view the semaphore as a variable that has an integer value upon
b) The wait operation decrements these semaphore value. If the value becomes negative the process
c) The signal operation increments the semaphore value. If the value is not positive then a process is
A binary semaphore accepts only 2 values 0 or 1. For both semaphore and binary semaphore a queue is
A strong semaphore has a mechanism of removing processes from a queue e.g. FIFO policy.
A weak semaphore doesn’t specify the order in which processes are removed from the queue.
Example of implementation:
wait (S);
Critical Section
signal (S);
2. Message passing
Provides a means for co-operating processes to communicate when they are not using shared memory
environment. Processes generally send and receive messages by using system calls such as: send
A blocking send must wait for receiver to receive the message. A non blocking send enables the sender to
continue with other processing even if the receiver has not yet received the message. This requires
Message passing can be flawless on some computers but in a distributed system it can be flawed or even
One complication in distributed systems with send / receive message passing is in naming processes
unambiguously so that send and receive calls references the proper process.
Process creation and destruction can be coordinated through some centralized naming mechanisms but
this can introduce considerable transmission overhead as individual machines request permission to use
new names.
3. Monitors
of declarations of variables and bodies of procedures or functions that implement operations of a given
type. It cannot be used directly by the various processes; ensures that only one process at a time can be
managed by the monitor. Data inside the monitor is accessible only to the process inside it. There is no
way for processes outside the monitor to access monitor data. This is called information hiding.
Event Counters
Introduced to enable process synchronization without use of mutual exclusion. . It keeps track of no of
occurrences of events of a particular class of related events. It is an integer counter that does not decrease.
Some operations will allow processes to reference event counts e.g. Advance (event Count), Read (event
Advance (E) –signals the occurrence of an event of the class of events represented by E by incrementing
event count E by 1.
Read (E) – obtains value of E; because Advance (E) operations may be occurring during Read (E) it is
only guaranteed that the value will be at least as great as E was before the read started.
Await (E) – blocks the process until the value of E becomes at least V; this avoids the need for busy
waiting.