Subject: Re: RD53s and swapping
To: Johnny Billquist <bqt@update.uu.se>
From: Lord Isildur <mrfusion@crue.jdwarren.com>
List: port-vax
Date: 01/25/1999 14:31:44
On Mon, 25 Jan 1999, Johnny Billquist wrote:
> As for memory shartage, having shared libraries really don't help you at
> all. Actually, you'll likely loose some.

righto

> 
> The libraries are shared on disk, not in memory.
> It will do wonders for disk space, though...

true. 

> 
> I'm not sure under which circumstances code is shared under current BSD.
> Someone please enlighten me. I'm still at the old sticky-bit stadium...

in BSD, the text segment is read-only. Multiple copies of the same image (as
determined from the image loaded by execve) are mapped via the virtual memory
system to the same actual image; the programs are unaware of any of this and
cant do anythign aboutit anwyays. paging and swapping are of course in the
form of the sum of the needs of each actual process. The sticky bit's use is
to indicate that those pages not be removed from the universe when the last
process running that text exits, but to keep them there to expedite the
loading of it in a subsequent execve() of that image. 
Shared libraries are different- they are just like the archive libraries that
you'd be familiar with except that the linking does not occur at some
point before the program is invoked, but at run-time. the dynamic linker 
links and loads the actual text of library calls off of the stubs left in an
executable image as the process needs them. This saves disk space by not
having dozens of copies of the same code in all your binaries, but also in
my opinion causes lots or problems when people 'upgrade' a library or move
a program to a different system where the shared libs are a little different. 
/*begin anti-shared-library rant here*
I like statically linked images and dont liek shared libs. Shared libs make
for a slower execution (nto noticeable unless youre constantly calling
library functions, but ti is overhead) because of the fact that the dynamic
loader is goign to have to be doing VM magic behind the scenes, it wastes 
memory because of the extra glue code that has to be there, and it puts
a program into a more constrained world of dependence on external factors. 
Its one thing to depend on the existence of a familiar operating system and
some system calls- to be dependent on libraries being there makes things
very inconvenient in my opinion. still, you do save gallons of disk space
with them. For example, the ELF binary format is an attempt to sptreamline the
process of using dynamic linkage by trying to reduce some of the overhead
associated with it. Still a bad move imho. :-)
*end anti-shared-library rant*/

happy hacking,
isildur