We are here to give you the Sight & Sound of Information Technology
Operations on Process (Operating System)
Several processes can execute simultaneously within the operating system. These processes can be created and deleted. Thus, an operating system must provide a mechanism to create and terminate these processes.
Following two are main operations on the processes:
A process can create several new processes during its execution, by using the process creating system calls. The creating process is called Parent Process, while the process which has been created by parent process, is known as Child Process. These child processes may create several new processes, thus creating a tree of processes. Almost all the operating systems identify a process from a unique integer number, which is called Process identifier or Process ID.
There are following three options for resource sharing among parent and child process:
- The child process will use all the resources of the parent process and vice versa.
- The child process will use subset of the resources of the parent process and vice versa.
- The child process will not use any resource of the parent process and vice versa.
There are following two options regarding the address space:
- The child process will be the exact copy of the parent.
- The child process will have its own code.
There are following two options regarding the running of the processes:
- The parent process will wait till the termination of the child process.
- The parent and child processes will execute simultaneously.
A process can be created by its parent process by using Fork or vFork commands. These commands are used mainly for creating a process. There is a slight difference among these two. Fork command create a child process but doesn't block the parent process, on other side, vFork command create a child process and blocks the parent.
Fork creates the new process by duplicating the parent process. Thus, the new process will be the exact copy of its parent process. However, the child process will have some different properties from parent, some of them are:
- The child process will have its unique ID.
- The child process will not inherit the memory locks.
- The child process will not inherit record locks from parent process.
- The set of pending signals of the child process will be initially empty.
vFork creates a child process and block the parent process. The vfork is different from the Fork in that the child process can share the code and data with the parent process.
A process will terminate when it will complete its execution and it will ask the operating system to terminate it by using the Exit() Command. At this point, a child process may return a status value to its parent process. All the resources will be de-allocated by the operating system. A parent may terminate its child process due to any of the following reasons:
- The job assigned to the child is no more required.
- The resource violation has occurred.
- The child process has completed the job assigned.
- The parent process is exiting.
A process may also terminate due to following reasons:
- Job or task assigned has completed.
- Mathematical error.
- IO error.
- Protection error.
The contents available on this website are copyrighted by TechPlus unless otherwise indicated. All rights are reserved by TechPlus, and content may not be reproduced, published, or transferred in any form or by any means, except with the prior written permission of TechPlus.