*BSD News Article 29434


Return to BSD News archive

Xref: sserve comp.os.386bsd.misc:2308 comp.os.linux.misc:12859
Path: sserve!newshost.anu.edu.au!munnari.oz.au!foxhound.dsto.gov.au!fang.dsto.gov.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!news.cs.su.oz.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!yeshua.marcam.com!charnel!xmission!u.cc.utah.edu!cs.weber.edu!terry
From: terry@cs.weber.edu (Terry Lambert)
Newsgroups: comp.os.386bsd.misc,comp.os.linux.misc
Subject: Re: Impressions: FreeBSD vs Linux
Date: 13 Apr 1994 00:28:49 GMT
Organization: Weber State University, Ogden, UT
Lines: 44
Message-ID: <2ofec1$olt@u.cc.utah.edu>
References: <CnH9JG.3Ap@hippo.ru.ac.za> <yX2Lkc3w165w@oasys.pc.my>
NNTP-Posting-Host: cs.weber.edu

In article <yX2Lkc3w165w@oasys.pc.my> othman@oasys.pc.my (Othman Ahmad) writes:
>Warning! Shared libs will slow down your machine and save only little of
>your overall disk space(only 10%), because data is much more than code.

What?!?

First off, the changes to the FreeBSD VM system *vastly* improve the
shared library performance.  There is minor degradation for initial page
mapping on load, but in most cases, the shared libraries are already
there because of some other binary and the cost is a ptdi rewrite for
the process coming up.  This is nearly zero cost.

I personally dislike reference faulting of the function table, since I'd
rather pay for the ld.so at load time instead of at runtime, but this
isn't much of an issue, and a change here would *slow* loading instead.

The disk space saved is tremendous.  The vast majority of data in a program
is unitialized, which means it can be mapped as zero fill fault-in, and
thus takes no space on disk.  You might notice that traditional (read as
"run on the most platforms") Windows programs have a 64k data limit without
wiring pages down as non-relocatable 64k at a time, while their text (code)
size is much, much larger.  In a standard DOS executable, this would be
called "medium model".  In almost all cases, the text size is vastly
larger than the data size -- and this is no exception in a UNIX-like
environment.

Next, there is no reason with the default compilation method in GCC (ie:
without the -fwriteable-strings option) that non-modifiable (const) data
could not be similarly shared this is frequently done anyway.

Finally, the shared library code pages are shared between dissimilar
processes, and this *really* beats simple shared text mapping in static
binaries, which would mean hetrogeneous binaries each had their own copies
of printf.

In short, the benefits of shared libraries are *significant* when they
are implemented the right way.


					Terry Lambert
					terry@cs.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.