From owner-freebsd-questions@FreeBSD.ORG Mon Nov 17 19:58:42 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66624106564A for ; Mon, 17 Nov 2008 19:58:42 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA04.westchester.pa.mail.comcast.net (qmta04.westchester.pa.mail.comcast.net [76.96.62.40]) by mx1.freebsd.org (Postfix) with ESMTP id 24FC48FC0C for ; Mon, 17 Nov 2008 19:58:37 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA02.westchester.pa.mail.comcast.net ([76.96.62.19]) by QMTA04.westchester.pa.mail.comcast.net with comcast id gF0n1a00J0QuhwU54KyZqA; Mon, 17 Nov 2008 19:58:33 +0000 Received: from koitsu.dyndns.org ([69.181.141.110]) by OMTA02.westchester.pa.mail.comcast.net with comcast id gKyT1a00o2P6wsM3NKyUkw; Mon, 17 Nov 2008 19:58:29 +0000 X-Authority-Analysis: v=1.0 c=1 a=6I5d2MoRAAAA:8 a=QycZ5dHgAAAA:8 a=J9_yzDYcLmlfNkAK_XAA:9 a=dMvBB6VoNGWyny0Gw4i-BRnzK7kA:4 a=EoioJ0NPDVgA:10 a=SV7veod9ZcQA:10 a=LY0hPdMaydYA:10 Received: by icarus.home.lan (Postfix, from userid 1000) id 176F933C36; Mon, 17 Nov 2008 11:58:27 -0800 (PST) Date: Mon, 17 Nov 2008 11:58:27 -0800 From: Jeremy Chadwick To: Daniel Howard Message-ID: <20081117195827.GA38388@icarus.home.lan> References: <4ad871310811101530p7b2baa0fk7f7b5118e314c11d@mail.gmail.com> <4918CE42.3050504@ccstores.com> <20081115061957.GA10998@ourbrains.org> <20081116023239.GA89267@icarus.home.lan> <20081116033624.GA13618@ourbrains.org> <20081116050107.GA91940@icarus.home.lan> <491fd833.zbV+im4fHqUJ5RRJ%perryh@pluto.rain.com> <20081116104103.GA98266@icarus.home.lan> <2a5241e00811171145y65e421e8q1210604d8be169b4@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a5241e00811171145y65e421e8q1210604d8be169b4@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: perryh@pluto.rain.com, freebsd-questions@freebsd.org Subject: Re: root /etc/csh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 19:58:42 -0000 On Mon, Nov 17, 2008 at 11:45:52AM -0800, Daniel Howard wrote: > On Sun, Nov 16, 2008 at 2:41 AM, Jeremy Chadwick wrote: > > On Sun, Nov 16, 2008 at 12:22:11AM -0800, perryh@pluto.rain.com wrote: > [...] > >> > A statically-linked version of bash would waste significant amounts > >> > of memory, while a dynamically-linked/shared version would ease that > >> > pain. The same applies for any static vs. dynamic program. > >> > >> How so? Wouldn't a single in-memory instance of the bash text > >> segment be shared among all bash processes, across all users? > > > > http://lists.freebsd.org/pipermail/freebsd-stable/2007-August/thread.html#36647 > > http://lists.freebsd.org/pipermail/freebsd-stable/2007-August/036654.html > > "In response to the original post: The kernel's ELF > linker/loader for executables will share the text and > read-only segments for static executables." > > This is consistent with my understanding. A statically-linked bash > will consume more space on disk, and more memory the first time it is > loaded, but as with any other executable, the executable portion of > the program will be re-used each time another bash is run. We didn't get an answer to Oliver's question (see the bottom half of his mail): http://lists.freebsd.org/pipermail/freebsd-stable/2007-August/036653.html > But I am not a developer or a kernel engineer, so if there is a way in > which a statically-compiled bash ends up consuming more memory on each > invocation for some reason, I'd appreciate an explanation as to why. Someone would need to go through and determine using nm or objdump (if possible), combined with procstat -v, to find how much would get wasted. It also depends on what options bash was built with. For example, I use WITHOUT_NLS everywhere, which decreases the overall footprint a bit. My (dynamic) bash binary on my box at home only links to libc and libncurses. As it stands presently, I am under the belief that the benefits of shared/dynamic outweigh static for specific environments. I think I mentioned it earlier in my mail, but on a machine with 1500 shell users, the benefits of shared/dynamic stand out (think: sshd and bash). I do understand your point and where you're coming from, though. It might not matter "as much" for bash, but I also worry the attitude would start to get applied to other shells (like zsh, which is *heavily* shared/dynamic). -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |