Date: Mon, 17 Nov 2008 11:58:27 -0800 From: Jeremy Chadwick <koitsu@freebsd.org> To: Daniel Howard <dannyman@toldme.com> Cc: perryh@pluto.rain.com, freebsd-questions@freebsd.org Subject: Re: root /etc/csh Message-ID: <20081117195827.GA38388@icarus.home.lan> In-Reply-To: <2a5241e00811171145y65e421e8q1210604d8be169b4@mail.gmail.com> References: <Pine.GSO.4.63.0811102239200.846@hmacs.cmi.ua.ac.be> <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%2Bim4fHqUJ5RRJ%perryh@pluto.rain.com> <20081116104103.GA98266@icarus.home.lan> <2a5241e00811171145y65e421e8q1210604d8be169b4@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 17, 2008 at 11:45:52AM -0800, Daniel Howard wrote: > On Sun, Nov 16, 2008 at 2:41 AM, Jeremy Chadwick <koitsu@freebsd.org> 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 |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081117195827.GA38388>