Re: Shared libraries revisited

From: <jrp_at_nospam.org>
Date: Fri Aug 27 1993 - 16:02:20 PDT

> * Startup times may be slow, although I don't really think so. If it
> really proves to be slow, we can always put the standard libs at
> fixed addresses and prerelocate the executables (I think this is
> what is called `presnapping' in Primos).

Not quite, you prerelocated at share time, there are no fixed addresses.
So, you share libc, which gets no relocatables prelocated. Then you share
libspam, which gets it's printf pointed to the one in libc.
If you want to be spiffy (which you probably do), you then go back to libc's
'relocatable' table, and try to snap them to shared images.

I.E. what you do is snap the links at 'share' time, to links you already know about.
For example, libc relocatable (dynamic) address (stored in a pleasant structure
for easy access) get replaced with fixed addresses at share time, not at link
time (static links) nor at run time (normal dynamic links). This means
that you take most of the startup hit when you share the library
(once, at boot time, who cares about a few seconds?), instead of whenever you run a
program (when everybody cares about a few seconds).

> * It is not possible to override parts of a library. If you include
> a different version of e.g. fprintf in your program, the library will
> still use its own version. Actually I am not even sure if this is a
> disadvantage :-)

This sucks. This implies poor dynamicity. I've found that replacing
system services with your own meta-service, which may, for
instance, count occurences, or something, is *extrememly* helpful
in debugging, especially so-called 'ring 3' services. So, you really
want a LD_LIBRARY_PATH=/magic/path:/usr/lib. (If you want
to have protection, you have a 'SYSTEM_LD_LIBRARY_PATH' (not an environment variable)
which gets prepended to the LD_LIBRARY_PATH in the search list in the kernel.)

Where, when you run a program, it looks at /home/jrp/mylib, then for the
shared version in /magic/path, then in /usr/lib for non-shared versions.

If you want to run in debug mode, you set LD_LIBRARY_PATH=/home/jrp/mylib:/usr/lib,
which should then link to mylib's fprintf, overriding the one in /usr/lib.

--
Jason R. Pascucci
jasonp%accint.uucp@dmc.com
Received on Fri Aug 27 16:50:48 1993

This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 19:37:12 PDT