How to guarantee the death of a child process

Todd Chauvin chauvin at galway.jpl.nasa.gov
Thu Nov 15 05:05:38 AEST 1990


Hello,

I am working with a large simulation of a complicated communications network.
The program is implemented as three separate processes.  

On startup:  	1) parent creates three pipes
		2) for each of the two child processes, parent does a 
		   vfork/exec, assigning input/output streams to
		   the pipes created in (1)

This simulation program is only useful if all three processes are running.

The problem:

	How can I arrange the processes such that if any one of them dies
	for *any* reason, the remaining two will be killed.

I've experimented with catching SIGCHLD in the parent process but with only
limited success.  The problems that I can't figure out how to solve with
SIGCHLD are (1) figuring out which child generated the SIGCHLD  (2) stopping
SIGCHLD from being delivered to the parent when the parent process is
stopped from the keyboard and put into background, and (3) SIGCHLD only 
detects the death of a child.  If I kill the parent, how do the child 
processes know to die?  

Anyone have any ideas how this should be done? Any thoughts/advice appreciated!

Todd Chauvin
chauvin at galway.jpl.nasa.gov



More information about the Comp.unix.programmer mailing list