Newsgroups: comp.os.minix
Subject: Re: dumb question: do you fork()?
References: <937lsp$dnl$1@nnrp2.phx.gblx.net> <938ekj$93itf$1@ID-57378.news.dfncis.de> <slrn95fqab.kc.scott@odin.buserror.net> <939c61$2fr6$3@gavrilo.mtu.ru>
Organization: Rochester Institute of Technology, Rochester, NY
From: aje9383@osfmail.isc.rit.edu (Andrew Erickson)
NNTP-Posting-Host: grace.isc.rit.edu
X-Original-NNTP-Posting-Host: grace.isc.rit.edu
Message-ID: <3a5a4046@news.isc.rit.edu>
Date: 8 Jan 2001 17:33:42 -0500
X-Trace: 8 Jan 2001 17:33:42 -0500, grace.isc.rit.edu
Lines: 30
XPident: aje9383
X-Original-NNTP-Posting-Host: 129.21.4.100
XPident: Unknown
Path: news.adfa.edu.au!clarion.carno.net.au!news0.optus.net.au!news1.optus.net.au!optus!newshub1.rdc1.nsw.optushome.com.au!news.mel.connect.com.au!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!logbridge.uoregon.edu!news.acsu.buffalo.edu!bingnews.binghamton.edu!news-nysernet-16.sprintlink.net!news.sprintlink.net!news.isc.rit.edu!aje9383
Xref: news.adfa.edu.au comp.os.minix:36472

[alt.os.development dropped because my news server doesn't think it's valid
and my newsreader is therefore unwilling to post to it.]

In article <939c61$2fr6$3@gavrilo.mtu.ru>,
Maxim S. Shatskih <maxim@storagecraft.com> wrote:
>> It is not uncommon for a process to execute code betwen the fork and the
>> exec without needing to reference any memory (other than the code) of the
>> parent.
>
>That is what vfork() is for.

I suspect you misread something here; this is exactly what vfork() is *not*
for.  vfork() is generally used where you have nothing to do between the
*fork() and the exec*() call.  (Actually, I suspect vfork() is more
frequently abused to exploit the shared data space that some implementations
provide than used correctly, despite this being explicitly nonportable.  I
think I recall that POSIX explicitly allows vfork() to be identical to
fork().)

I actually doubt there are too many situations where substantial amounts of
code (of any sort) is executed but no data memory accessed.  It's hard to do
much useful without calling functions and without having scratch registers
spill into temporary storage--although the latter case is far more likely on
a reasonable RISC chip, with many registers, than on a 68K or (shudder) an
x86.

>    Max

-- 
Andrew Erickson
