Creation and Termination of a process

Posted by: Clare Vella (4 years, 1 month ago)

Process Creation

A process is created if one of the four principals happens while using a computer:

  • Starting up the computer.
  • Running a program.
  • A new process requested directly by the user.
  • Initiation of a batch job.

Operating systems need some ways to create and terminate processes as needed during operation.

When an operating system is started up, normally several processes are created. Some of these processes work directly with the interaction of a (human) user and therefore perform work for them.

Other processes work ‘behind the scenes’ which do not require user intervention, but instead have some specific functions. A simple example of a background process is the one accepting any incoming emails; it stays in ‘sleep’ mode for most of the time but starts working when an incoming e-mail arrives, all in the background without notifying the user.

Another background process may be designed to accept an incoming request for web pages hosted on the machine, working only when a request arrives to service that request.

Process Termination

A process termination can occur for many reasons, such as:

  • User logging off
  • Process executing a service request to terminate
  • Normal completion
  • Unavailable memory
  • Fatal error, etc.

Operating systems need to terminate a process in order to reclaim resources such as memory, files, etc.  Once a process is terminated it is said to be a ‘dead process’. 

The parent process may then wait for the child process to terminate, or may continue execution (possibly forking off other child processes). When the child process terminates ("dies"), either normally by calling exit, or abnormally due to a fatal error or signal an exit status is returned to the operating system and a SIGCHLD signal is sent to the parent process. The exit status can then be retrieved by the parent process via the wait system call.

Most operating systems allow the terminating process to provide a specific exit status to the system, which is made available to the parent process.  The exit operation typically performs clean-up operations within the process space before returning control back to the operating system. Some systems and programming languages allow user subroutines to be registered so that they are invoked at program termination before the process actually terminates for good. As the final step of termination, a primitive system exit call is invoked, informing the operating system that the process has terminated and allows it to reclaim the resources used by the process.

On a different note, a process can be orphaned unintentionally, such as when the parent process terminates or crashes. An orphan process is a computer process whose parent process has finished or terminated, though it remains running itself.  These orphaned processes waste server resources and can potentially leave a server starved for resources. However, there is a program that can detect such unused processes for you.  You can try a free scan by clicking on the right hand side banner of SpeedUpMyPC.

← Too many processes running on my PC What is round-robin scheduling? →

Process Library is the unique and indispensable process listing database since 2004 Now counting 140,000 processes and 55,000 DLLs. Join and subscribe now!

System Tools

PC Mechanic