Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Nov 1997 20:04:54 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        cmott@srv.net (Charles Mott)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Is fork() copy-on-write ?
Message-ID:  <199711170104.UAA26711@dyson.iquest.net>
In-Reply-To: <Pine.BSF.3.96.971116171305.10703B-100000@darkstar.home> from Charles Mott at "Nov 16, 97 05:19:07 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Charles Mott said:
> I was curious to know when a process is forked, are the new vm pages which
> are created copy-on-write?
> 
> [I know, I know I should just go look at the source code, but I haven't
> quite got up the nerve to start looking at that area.  It is sort of like
> peering over a cliff into an infinite abyss.]
> 
In the FreeBSD kernel, ALL pages that can be COW are COW -- if anyone finds the
contrary PLEASE tell me ASAP (and I'll fix it.)  One of the original
problems in the BSD 4.4VM, fixed in FreeBSD,  was that originally, during a fork,
as many as three (3) pages would exist for every page COW after a fork.  We have
reduced that to two (2) in the normal case.  Of course, that is what is expected,
but when figuring out what that code does, expect the unexpected!!! :-).

(Note that many versions of UNIX don't bother COW on modified .data actually
 performing explicit copies for .data pages, but the FreeBSD/Mach VM doesn't do
 any unnecessary copies.)

-- 
John
dyson@freebsd.org
jdyson@nc.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711170104.UAA26711>