Operations on Process:
Operations on Process:
The process in the system can
execute concurrently and they must be created and deleted dynamically. Thus,
the operating system must provide a mechanism for process creation and
termination.
Process Creation: A process may create several new processes via a create process
system call during the course of execution. The creating process is called a
parent/main process whereas the new process is called the children/sub-process of the process.
Each of these new processes may in turn create other processes forming a tree
of processes.
Figure: A tree of Process
A process during execution needs various resources like
CPU time, memory files, input/Output devices, etc. when a process create sub-processes,
the sub-process too will require some of the resources. The sub-process may be
able to obtain its resources directly from the operating system or it may be
constrained to a subset of the resources of the parent process. The parent may
have to partition its resources among its children. Or it may be able to share
some resources among several of its children. Restricting a child process to
subset of the parent’s resources prevents any process from overloading the
system by creating too many sub-processes.
When a process creates a
new process, following two possibilities exists in terms of execution-
- The parent continues to execute concurrently with its children.
- The parent waits until
some or all of its children have terminated.
There are also two possibilities in terms of the address space of the new process: -
- The child process is
duplicate of the parent process.
- The child process has a
program loaded into it.
Process Termination: A process terminates when it finishes executing its final statement and asks the operating system to delete it by using the ‘exit’ system call. At that point the process may return data (output) to its parent process (via the ‘wait’ System call). All the resources of the process are reallocated by the operating system. Termination might occur under additional circumstance also. For example: a process can cause the termination of another process via an appropriate system call / (abort).
Usually only the
parent of the process that is to be terminated can invoke such a system call,
otherwise users would arbitrarily keep aborting each other job. A parent
therefore needs to know the identities of its children. Thus, when one process
creates a new process the identity of the newly created process passed to the
parent.
A parent can terminate the
execution of its children for a number of reasons:
- If the child has exceeded
its usage of some of the resources that it has been allocated.
- The task assigned to the
child no longer required.
- The parent is
terminating; in this case the operating system does not allow a child to
continue if its parent terminates. So, if a process terminates (either normally,
or abnormally) then all its children must also be terminated. This is called as
cascading termination and is normally initiated by the Operating system.
Comments
Post a Comment
Thank you for message