The Linux Programming Interface

(nextflipdebug5) #1

Chapter 26: Monitoring Child Processes


In many application designs, a parent process needs to know when one of its child
processes changes state—when the child terminates or is stopped by a signal. This
chapter describes two techniques used to monitor child processes: the wait() system
call (and its variants) and the use of the SIGCHLD signal.

26.1 Waiting on a Child Process


In many applications where a parent creates child processes, it is useful for the
parent to be able to monitor the children to find out when and how they terminate.
This facility is provided by wait() and a number of related system calls.

26.1.1 The wait() System Call...........................................................................


The wait() system call waits for one of the children of the calling process to termi-
nate and returns the termination status of that child in the buffer pointed to by status.
Free download pdf