Process creation:
            Processes are created with the fork system call (so the operation of creating a new process is sometimes called forking a process). The child process created by fork is a copy of the original parent process, except that it has its own process ID. Each process is named by a process ID number. A unique process ID is allocated to each process when it is created. The lifetime of a process ends when its termination is reported to its parent process; at that time, all of the process resources, including its process ID.
After forking a child process, both the parent and child processes continue to execute normally. If the programmer wants the program to wait for a child process to finish executing before continuing, the programmer must do this explicitly after the fork operation, by calling wait or waitpid. A newly forked child process continues to execute the same program as its parent process, at the point where the fork call returns. The return value  can be used from fork to tell whether the program is running in the parent process or the child.
The creation of a process requires the following steps. The order in which they are carried out is not necessarily the same in all cases.

  1. Name. The name of the program which is to run as the new process must be known.
  2. Process ID and Process Control Block. The system creates a new process control block, or locates an unused block in an array. This block is used to follow the execution of the program through its course, keeping track of its resources and priority. Each process control block is labeled by its PID or process identifier.
  3. Locate the program to be executed on disk and allocate memory for the code segment in RAM.
  4. Load the program into the code segment and initialize the registers of the PCB with the start address of the program and appropriate starting values for resources.
  5. Priority. A priority must be computed for the process, using a default for the type of process and any value which the user specified as a `nice' value (see Run levels - priorities above).
  6. Schedule the process for execution.

 Process termination:
Processes can be terminated in one of two ways:

  • Normal Termination occurs by a return from main or when requested by an explicit call to exit or _exit.
  • Abnormal Termination occurs as the default action of a signal or when requested by abort.

On receiving a signal, a process looks for a signal-handling function. Failure to find a signal-handling function forces the process to call exit, and therefore to terminate. The functions _exit, exit and abort terminate a process with the same effects except that abort makes available to wait or waitpid the status of a process terminated by the signal SIGABRT.
As a process terminates, it can set an eight-bit exit status code available to its parent. Usually, this code indicates success (zero) or failure (non-zero).
            If a signal terminated the process, the system first tries to dump an image of core, and then modifies the exit code to indicate which signal terminated the process and whether core was dumped. This is provided that the signal is one that produces a core dump. Next, all signals are set to be ignored, and resources owned by the process are released, including open files and the working directory.