Subject: Re: Question about text segments and NetBSD and Solaris 2
To: Curt Sampson <cjs@portal.ca>
From: John S. Dyson <toor@dyson.iquest.net>
List: tech-kern
Date: 07/27/1997 00:52:35
> On Fri, 25 Jul 1997 Vasanth_Kanchan@s3.com wrote:
> 
> >      After looking at the code it seems that the exec system call does not 
> >      check for  previous exec's of the same file. So for 5 exec's of a 
> >      program there will be 5 X sizeof(.text).
> 
> Did you check the VM system as well? As I understand it, exec(),
> when loading a program, tells the VM system to map this area of
> memory from that disk file. If it does that a second time, one
> would think that the VM system should see that there is already a
> read-only mapping for those pages, and create a new mapping that
> uses the same underlying physical pages and file.
> 
Modulo some details, you are right.  BSD does a pretty good job of sharing.

John