[comp.os.minix] No SIGCLD?

tim@amdcad.UUCP (02/09/87)

I haven't gotten an answer to my previous question about object file
formats, but I have another one regarding signals in minix.

In all of the discussions of signals supported in minix, I cannot find
SIGCLD (death of child) mentioned.  In fact, the code for exit() and
wait() in the memory manager implies that the resources for a child are
not released until the parent does an explicit wait() for the child (or
the parent is killed, in which case the child is inherited by init).

Without SIGCLD, there may be problems in implementing background jobs in
shells.  If we type

	cc -o foo foo.c &

we don't want the shell to wait() for the compilation to complete.  However,
when the compile completes, it sits in the zombie state (HANGING) forever,
using a process slot (and memory resources, too!).

This problem is solved in UN*X systems by notifying the shell when a child
exit()'s through the SIGCLD signal.  If this signal is caught, the signal
handler can perform the wait() (which immediately returns with a zombie)
and free up the child's resources.  [A good description of this problem
is found in M. Bach's book "The Design of the UNIX Operating System" on
page 216]

How do shells in minix get around this problem with no SIGCLD?


	Tim Olson
	Advanced Micro Devices
	(tim@amdcad)

gwyn@brl-smoke.UUCP (02/11/87)

In article <14675@amdcad.UUCP> tim@amdcad.UUCP (Tim Olson) writes:
-Without SIGCLD, there may be problems in implementing background jobs in
-shells.  If we type
-
-	cc -o foo foo.c &
-
-we don't want the shell to wait() for the compilation to complete.  However,
-when the compile completes, it sits in the zombie state (HANGING) forever,
-using a process slot (and memory resources, too!).

This is a non-problem.  7th Edition UNIX didn't have SIGCLD,
and indeed many of the Bourne shells even on systems with SIGCLD
don't use the signal.  What saves the situation is that the
first wait() performed after a child process terminates will pick
it up.  So the next time one does a non-& command, all is well.