Sys V fork IS broken!

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Jul 29 11:48:08 AEST 1990


In article <1990Jul28.195032.18746 at watdragon.waterloo.edu> tbray at watsol.waterloo.edu (Tim Bray) writes:
>  if ((child = fork()) == -1)
>    FatalSystemError("Serious system trouble! Can't create process!");
>... I think describing absence of special-purpose backoff & retry code for
>handling process creation failure by the OS as "bugs in application programs"
>is pretty arrogant and unrealistic.

The bug is that your application makes no attempt to recover from a known
class of error, EAGAIN in this case.  I would say the same thing about a
wait() loop that did not properly handle EINTR error returns.  (I bet you
have those, too.)  And of course many applications that directly use the
write() system call do not properly handle short write counts.  None of
these should be considered failings of the kernel; as Terry pointed out
in another recent posting, it is the responsibility of the application to
determine the policy to be used to deal with such situations, and the
best choice for the policy depends very much upon the application.  If
the programmer has not thought about these matters, then he has done an
imperfect job of program design.  Producing high-quality applications is
hard enough as it is; if the kernel were to impose somebody's arbitrary
notion of policy in such cases it would be impossible.



More information about the Comp.unix.wizards mailing list