From owner-freebsd-questions Wed Nov 6 09:31:30 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA05829 for questions-outgoing; Wed, 6 Nov 1996 09:31:30 -0800 (PST) Received: from zwei.siemens.at (zwei.siemens.at [193.81.246.12]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA05809 for ; Wed, 6 Nov 1996 09:31:20 -0800 (PST) Received: from sol1.gud.siemens.co.at (root@[10.1.143.100]) by zwei.siemens.at (8.7.5/8.7.3) with SMTP id SAA21029 for ; Wed, 6 Nov 1996 18:29:35 +0100 (MET) Received: from ws2301.gud.siemens.co.at by sol1.gud.siemens.co.at with smtp (Smail3.1.28.1 #7 for ) id m0vLBnu-00021LC; Wed, 6 Nov 96 18:30 MET Received: by ws2301.gud.siemens.co.at (1.37.109.16/1.37) id AA125371354; Wed, 6 Nov 1996 18:29:14 +0100 From: "Hr.Ladavac" Message-Id: <199611061729.AA125371354@ws2301.gud.siemens.co.at> Subject: Re: OS Memory questions To: timp@orion.ab.ca (Tim Pushor) Date: Wed, 6 Nov 1996 18:29:14 +0100 (MEZ) Cc: questions@FreeBSD.org In-Reply-To: from "Tim Pushor" at Nov 6, 96 10:24:44 am X-Mailer: ELM [version 2.4 PL24 ME8a] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk 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 > > > >