Is System V.4 fork reliable?

stephen.a.rago sar0 at cbnewsl.att.com
Sat Aug 4 11:19:58 AEST 1990


In article <575 at oglvee.UUCP>, jr at oglvee.UUCP (Jim Rosenberg) writes:

[much rambling deleted...]

> I am truly mortified that **NO ONE** has posted an explanation of just what
> the deadlock would be if the kernel did allow sleep in allocating memory for a
> fork.

There is a deadlock if the kernel had to wait for proc slots, because if
all the processes were trying to fork, and nobody intended to exit, then
every process (except the kernel procs and init) would be waiting indefinitely
in the kernel for an event that would never occur.

However, the same deadlock is still possible when you kmem_alloc(KM_SLEEP)
a proc structure, only it's a lot less likely to occur because the memory
can be coming from other places (like STREAMS messages, etc.)  The only
time you'll deadlock is when no more memory is available and everyone is
waiting to allocate the space for their own proc structure.

Steve Rago
sar at attunix.att.com



More information about the Comp.unix.wizards mailing list