Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 1996 18:29:14 +0100 (MEZ)
From:      "Hr.Ladavac" <lada@ws2301.gud.siemens.co.at>
To:        timp@orion.ab.ca (Tim Pushor)
Cc:        questions@FreeBSD.org
Subject:   Re: OS Memory questions
Message-ID:  <199611061729.AA125371354@ws2301.gud.siemens.co.at>
In-Reply-To: <Pine.NEB.3.92.961106101734.2980A-100000@centaur.orion.ab.ca> from "Tim Pushor" at Nov 6, 96 10:24:44 am

next in thread | previous in thread | raw e-mail | index | archive | help
E-mail message from Tim Pushor contained:
> I am fairly new to UNIX programming, and have found a home with FreeBSD
> :-) I have a couple of questions though about how FreeBSD deals with text
> memory.
> 
> 1) If I have an app that uses a shared lib, and that shared lib is is use
> by another app, do the apps share the text area?

Yes.  They even share the data area as long as it has not been modified.
> 
> 2) If I fork, is the text area shared?

Yes.  Data as well, prior to any modifications thereof.
> 
> 3) I am using C++. In one case, I have a class that I use many times, e.g.
> 	MyClass class1,class2,class3,class4,class5;
> This class is basically just data, but does have a fairly elaborate
> constructor to massage the data, and allocate memory for other operations.
> My question is: Does the system share the text area of the class? It would
> seem a waste to have a copy of the code in memory multiple times.

Yes.  The system will use the same unmodified pages for all instances of
the same program, regardless who and how started it.

John Dyson will probably have more to say about the actual mechanism used.

/Marino

> 
> Thanks for any and all help.
> 
> Tim
> ---
> Tim Pushor, Senior Systems Engineer | Phone: (403) 284-0042
> Orion Technologies Inc.             | FAX:   (403) 284-9495
> timp@orion.ab.ca                    | http://www.orion.ab.ca
> 
> 
> 
> 




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