Is System V.4 fork reliable?

Boyd Roberts boyd at necisa.ho.necisa.oz
Thu Aug 9 14:08:22 AEST 1990


In article <553 at bohra.cpg.oz> als at bohra.cpg.oz (Anthony Shipman) writes:
>At the risk of getting in out of my depth!
>
> [stuff deleted]
>
>A standard simple "naive" solution to break the deadlock is to kill one of the
>processes at the request point. In this case, make the fork() fail. If several
>retries fail then abort the program (and release memory). An indefinite wait
>would be dangerous.
>

NO, NO, NO!  You do not _understand_.  _Never_ do that.  NEVER!

Which proc will you kill?  And when (if ever) will it run so it can exit()?

It's very simple.  When you're low on ram & swap and processes are
fighting for this resource there's bugger all you can do.  Sure you
can purge a few sticky texts but in a pathological case you run out
of resources and there is nothing you can do.

What is required are pre-emptive measures, such as:

   * memory limits
   * working set limits
   * warn that resources are about to expire (say 90% consumed)

With these things a human can make decisions that will best serve
the system's purpose.  You've only got so much cake so you'd better
choose well how it will best be eaten.  Prevent the disaster from
happening and then you won't have to code in disaster recovery.


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