Who is responsible for a retry (was Re: Is System V.4 fork reliable?)

Boyd Roberts boyd at necisa.ho.necisa.oz
Wed Aug 8 10:57:49 AEST 1990


In article <35 at kings.co.uk> lls at kings.UUCP (Superuser) writes:
>
>The code that I write does check for EAGAIN and retry - however, other
>utilities and packages that I call (including /bin/sh) do not - how do 
>I fix that?

I've just read the the System V.2.2 shell code and guess what?
It retries the fork() with backoff.  So your shell must be broken.

The deal is that when fork() fails -- all is not well.  The kernel is
not psychic and can't predict what will happen in the future.  The
caller of fork() is responsible to take action.

When fork() does fail what can you do?  Not much, you can give up
in disgust or retry.  BUT THERE IS NO GUARANTEE THAT THE ANY AMOUNT
OF RETRYING WILL GET YOU THAT NEW PROCESS.  What's happened is that a
kernel resource has been exhausted and you have no way of predicting
whether any relevant resources in use will be freed up in the future.

I'm with presotto & hume.  But when you're faced with retrying you have
to ask the question -- is it worth it, and if so how long should I try?


Boyd Roberts			boyd at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.wizards mailing list