Operations on Processes
Operations on Processes
Operations on Processes
The operations of process carried out by an operating system are primarily of two
types:
1. Process creation
2. Process termination
1) Process Creation
Process creation is a task of creating new processes. There are different
situations in which a new process is created. There are different ways to create new
process. A new process can be created at the time of initialization of operating
system or when system calls such as fork () are initiated by other processes. The
process, which creates a new process using system calls, is called parent
process while the new process that is created is called child process. The child
processes can create new processes using system calls. A new process can also
create by an operating system based on the request received from the user.
2) Process termination
Process termination is an operation in which a process is terminated after
the execution of its last instruction. This operation is used to terminate or end
any process. When a process is terminated, the resources that were being utilized by
the process are released by the operating system. When a child process terminates,
it sends the status information back to the parent process before terminating. The
child process can also be terminated by the parent process if the task performed by
the child process is no longer needed. In addition, when a parent process terminates,
it has to terminate the child process as well became a child process cannot run when
its parent process has been terminated.
The above figure shows the hierarchical structure of processes.
The termination of a process when all its instruction has been executed
successfully is called normal termination. However, there are instances when a
process terminates due to some error. This termination is called as abnormal
termination of a process.
Cooperating Process
Cooperating processes are those that can affect or are affected by other processes running on
the system. Cooperating processes may share data with each other.
Modularity
Modularity involves dividing complicated tasks into smaller subtasks. These subtasks can
completed by different cooperating processes. This leads to faster and more efficient
completion of the required tasks.
Information Sharing
Sharing of information between multiple processes can be accomplished using
cooperating processes. This may include access to the same files. A mechanism is
required so that the processes can access the files in parallel to each other.
Convenience
There are many tasks that a user needs to do such as compiling, printing, editing etc. It is
convenient if these tasks can be managed by cooperating processes.
Computation Speedup
Subtasks of a single task can be performed parallely using cooperating processes. This
increases the computation speedup as the task can be executed faster. However, this is
only possible if the system has multiple processing elements.
Methods of Cooperation
Cooperating processes can coordinate with each other using shared data or messages. Details
about these are given as follows −
Cooperation by Sharing
The cooperating processes can cooperate with each other using shared data such as
memory, variables, files, databases etc. Critical section is used to provide data integrity
and writing is mutually exclusive to prevent inconsistent data.
A diagram that demonstrates cooperation by sharing is given as follows −
In the above diagram, Process P1 and P2 can cooperate with each other using shared
data such as memory, variables, files, databases etc.
Cooperation by Communication
The cooperating processes can cooperate with each other using messages. This may
lead to deadlock if each process is waiting for a message from the other to perform a
operation. Starvation is also possible if a process never receives a message.
A diagram that demonstrates cooperation by communication is given as follows −
In the above diagram, Process P1 and P2 can cooperate with each other using messages to
communicate.