qfork()

John F Haugh II jfh at rpp386.cactus.org
Mon Jan 14 15:34:31 AEST 1991


Submitted-by: jfh at rpp386.cactus.org (John F Haugh II)

In article <16873 at cs.utexas.edu> mohta at necom830.cc.titech.ac.jp (Masataka Ohta) writes:
>You should also know that copy-on-write fork(), unlike vfork(), is inherently
>buggy and can not be a general-purpose useful memory management mechanism.

You are confusing theory with implementation.  There is nothing "inherently"
buggy with either vfork() or copy-on-write fork().  vfork() is fairly
inflexible, and as pointed out by other writers, completely superfluous
given a properly implemented fork().

>If you have 50MB swap space and want to fork() 30MB process to exec less
>than 1MB shell, you can't. With COW fork(), there is workaround. But the
>workaround is so incomplete that the system sometimes deadlocks.

Again, the problem you are alluding to results from the choice of early
or late allocation of paging space.  If you choose early allocation, you
are correct - you can't fork() a 30MB process with only 20MB remaining.
And yes, if you choose late allocation it is possible to deadlock, but
only in the cases where you are doing more than you are with vfork().
Thus your complaint is simply invalid.  If I modify no pages between
fork() and exec() with late allocated COW fork(), I will =never= run
out of page space simply because I required no additional pages.  Any
scenario where I do modify a page is unsuitable for vfork(), so there
is no room for comparision of the merits of fork() with vfork().

>Thus, fork(), even COW fork(), is not a proper mechanism to fork-exec
>other processes.

If you wish to describe some operation which is a simple fork-exec
then you are correct.  However, process creation frequently involves
more than forking and execing a new command.  It often involves the
creation of IPC mechanisms (pipes, etc), signal manipulation, I/O
redirection, ad nauseum.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"While you are here, your wives and girlfriends are dating handsome American
 movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."

Volume-Number: Volume 22, Number 67



More information about the Comp.std.unix mailing list