On Mon, Nov 17, 2008 at 11:45:52AM -0800, Daniel Howard wrote:
> On Sun, Nov 16, 2008 at 2:41 AM, Jeremy Chadwick <[EMAIL PROTECTED]> wrote:
> > On Sun, Nov 16, 2008 at 12:22:11AM -0800, [EMAIL PROTECTED] 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 |

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to