Operations on Processes

  1. The parent process might issue a wait() system call, which will block (= pause) the parent process from executing until the child process terminates.
    • In some implementations, the wait() system call returns some statistical information on the child’s running and termination (normal or abnormal.)
    • Since a process can have several children, you could use a variation of the wait function, waitpid() (or WaitForSingleObject() in Windows,) which will wait for a specific child to terminate.
  2. Finally, a process is terminated when it calls the exit() system call.
    • When we return from the main function, the exit() system call is issued.
    • exit() returns an integer to its caller. As such, the parent process will get this integer when a child terminates via the status info returned from the wait() function.
    • Zero (0) usually indicates normal termination (success) and a non-zero indicates abnormal termination (failure).