From owner-freebsd-hackers Sat Nov 16 23: 4:47 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC15A37B401 for ; Sat, 16 Nov 2002 23:04:45 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F34643E4A for ; Sat, 16 Nov 2002 23:04:45 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gAH74h2q023525; Sat, 16 Nov 2002 23:04:43 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gAH74hGx023524; Sat, 16 Nov 2002 23:04:43 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sat, 16 Nov 2002 23:04:42 -0800 From: David Schultz To: Gary Thorpe Cc: Matthew Dillon , freebsd-hackers@FreeBSD.ORG Subject: Re: cvs commit: src/bin/sleep sleep.c Message-ID: <20021117070442.GB23317@HAL9000.homeunix.com> Mail-Followup-To: Gary Thorpe , Matthew Dillon , freebsd-hackers@FreeBSD.ORG References: <200211170158.gAH1wJhc035731@apollo.backplane.com> <20021117034219.13731.qmail@web41201.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021117034219.13731.qmail@web41201.mail.yahoo.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Gary Thorpe : > > Take /bin/csh (aka tcsh) for example. > > > > Startup overhead if static: 144 pages faults, 113 zero fill, 64 > > COW > > Startup overhead if dynamic: 310 page faults, 131 zero fill, 84 > > COW > > > > So the difference is 38 pages of memory = 152KB per instance. > > That's fairly significant on a multi-user system that might have > > several hundred csh's running. I specifically compile certain > > non-forked binaries on my system static precisely to reduce their > > memory footprint. > > Remember that those 38 pages may be completely shared in a dynamic > library, leading to memory usage reductions. What is true is that the > startup time for dynamic binaries is most likely slower. BSS and modified data are not shared, and Matt is only counting zero fill and COW faults. If you have lots of copies of a shell running, pages will be shared more effectively with a static binary. A shell is about the worst thing you could possibly choose to dynamically link. Dynamic linking makes sense for X11, on the other hand, because you want to run many different binaries that share a large common library (and the binaries are slow as dirt anyway!) I've argued against dynamically linking /bin and /sbin before. (See the current@ archives around Oct 30.) I wouldn't mind if someone implemented it, but I don't want to see a dynamic /bin and /sbin become the default. (Enough people are clammoring about it that I fear that this will happen anyway.) The only half-convincing argument in support of it I've heard has been the disk space. But the default install isn't targetting embedded systems, it's targetting workstations and servers. Neither of the latter categories ought to be trading performance for 30 measly megabytes of disk and additional foot-shooting opportunities. > Other (major?) reasons I have heard in favor of dynamically linking > root: > a. locale support > b. nsswitch.conf support > c. PAM support (maybe this encompasses b.) > > Dynamic linking has been said to be the only way to get locale support > and support for multiple authentication schemes. I don't know if > dynamic linking is absolutely necessary to supports these things from a > technical standpoint, but it would be nice to know (does anyone know?). If you need pluggable locales, you might want dynamic linking. The other two can be done without dynamic linking, either by fixing dlopen() to work with static binaries or by creating daemons to handle the tasks. The former approach was discussed on current@ a few days ago, and I don't know much about it. The latter is also an entirely reasonable design, but someone needs to actually do the work. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message