From owner-freebsd-questions Sat Sep 21 15:40:10 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA26851 for questions-outgoing; Sat, 21 Sep 1996 15:40:10 -0700 (PDT) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id PAA26745 for ; Sat, 21 Sep 1996 15:40:04 -0700 (PDT) Received: (from root@localhost) by dyson.iquest.net (8.7.5/8.6.9) id RAA01564; Sat, 21 Sep 1996 17:39:55 -0500 (EST) From: "John S. Dyson" Message-Id: <199609212239.RAA01564@dyson.iquest.net> Subject: Re: Shells shells shells? To: roderick@gate.net (Roderick Schertler) Date: Sat, 21 Sep 1996 17:39:55 -0500 (EST) Cc: questions@freebsd.org In-Reply-To: from "Roderick Schertler" at Sep 21, 96 05:36:42 pm Reply-To: dyson@freebsd.org X-Mailer: ELM [version 2.4 PL24 ME8] 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 > > On Fri, 20 Sep 1996 09:03:20 -0500 (EST), "John S. Dyson" said: > > > > Shared libs both do not save memory in the case of progs like bash, > > but also slow down fork/exec times significantly. > > Would someone elaborate on this sentence, particularly the first half? > Shared libs don't have a very good locality of ref relative to the process that they are linked to. For example, the associated .data and .bss are not intimately linked with the application, but with the rest of the shared lib. The shared libs contain lots of excess routines, and when you fault pages in, you are many times getting data and text that you simply do not need. When a COW fault occurs on a shared lib .data page, you are likely only going to need a small part of that page. For some interesting info, look at the /proc/XXX/map file in -current. Since your shell runs with many concurrent invocations, your .text will be fully shared amongst the various shells, and the .data and .bss memory footprints will be smaller than if they were linked with shared libs. IMO, shared libs are mostly useful for a couple of reasons... Processes that run with few concurrent instances, disk space savings, and very large libraries where the advantage is significant (like X-windows libs.) IMO, Shells are not the best choice of programs to link with shared libs... X windows programs are on the other hand, very good choices of programs to link with shared libs. Other programs are somewhere in between. John