Shared libraries are not necessary

terryl at sail.LABS.TEK.COM terryl at sail.LABS.TEK.COM
Wed Jun 5 08:55:12 AEST 1991


In article <275 at titccy.cc.titech.ac.jp> mohta at necom830.cc.titech.ac.jp (Masataka Ohta) writes:
+In article <9613 at sail.LABS.TEK.COM> terryl at sail.LABS.TEK.COM writes:
+
+>+If, as if often the case, we are running only one X applications, you
+>+lose.
+>
+>     Maybe in your idealized world that is true, but I can assure you out in
+>the REAL world, MANY X applications are running at once, not one at a time.
+
+Your "the REAL world" is only a part of the real world.
+
+I'm in the real world and not using window systems at all.

     Fine. You work in your "real world", and I'll work in my "real world".
One thing I do know to be true: If I had to work in your "real world", I would
NOT be as productive as I am in my "real world".

     Here's a suggestion (NOT a request): Do a little survey of a company, and
find out how many workstations are running some sort of windowing system (be it
X, News, <whatever>). Since this discussion sort of started about Sun and their
workstations, me thinks Sun would be a good candidate....

+>Here's a partial ps listing of a local workstation running X:
+
+>I count 5 different X applications running (xdm, xterm, mwm, xclock, xeyes),
+>plus the server (listed as X in the above listing).
+
+On the other hand, you are the only person who has done this. No other
+people, who say they require many X applications, have shown what they
+are running.

     Ah, I see: proof of your assertions by lack of repsonse on the other
side. Not something that I'd want to count on....

+And, even you have not yet shown the result of 'ldd' and 'size'.
+
+Without that, you can say nothing.
+
+Please be technical.

     I have been technical, and who said anything about ldd & size??? I happen
to be running on a workstation that doesn't support shared libraries, and as
such I wasn't responding to specific shared libraries questions (except for my
response below). What I was responding to was your claim that "only one X
application runs at a time", and as such, provided some proof that it wasn't
true. You, on the other hand, haven't provided ANY proof of your claim, so I'm
having a hard time believing ANYTHING you say.

+> do you have ANY facts to back up the claim that you seem to making??
+>The claim is "If a shared library is used, ALL of the space of the shared
+>library(at least the text) will be loaded in the executable image". I make this
+>claim by adding together the text sizes of the shared libraries, along with the
+>text size of the original object file, and that's my interpretation of what you
+>are saying.
+
+You misinterpreted what I wrote.

     No, I didn't misinterpret what you wrote, but it doesn't matter anyhow,
since it has already been validated by a disinterested third party that the
claim I asked about "shared libraries will load ALL of the text space" is
actually true. Since I asked you a direct question, one that I thought was
reasonably clear in intention, and you chose not to answer the question, again
you haven't provided any proof for your claims, so by now I'm inclined not to
put much faith in anything you say.

+>+Though not all functions in 1.56Mbytes are actually called, most pages
+>+are swapped in if at least one function in the same page is called.
+
+>     Again, I'll ask you to provide some facts (and preferably figures, too)
+>to back up your claim "most pages ... same page is called". Given a reasonable
+>virutal memory subsystem, I doubt that this is true.
+
+It is obvious. As I counted, there are 479 functions defined and 250 object
+modules (*.o files) 'ar'ed in libX11.a. The text size of libX11.a is about
+180K. Thus, the average code size of a object module is about 720 bytes. If
+you have 8K page (a reasonable virtual memory subsystem, 16K might be more
+common), a typical page contains about 11 object modules.

     Thank you for at least providing some concrete proof here, but just
because there are quite a few "functions per page", you still haven't provided
any numbers on which functions are actually called, nor how often they are
called. Also, just because a function has been called before, unless it is
called fairly consistently, most reasonable virtual memory subsystems would
probably have it paged out (not swapped in).

+If you use 20% of modules (1 in 5 modules), unless there is strong
+correlation on calling pattern of library routines (most of strong correlation
+is already used up as strongly correlated functions are often already packed
+in a single object module), and unless you reorder object modules in the
+library, almost all text pages are swapped in.

    Again, I'll ask: how often are these modules called??? Once, twice, mul-
tiple times?? With my (admittedly limited) experience in X, most functions are
called just once, with just a few routines (Xgetnextevent, draw thingies, etc)
dominating the time spent in the libraries.

+By using the (possibly non-existing) above correlation, you might be able
+to reduce memory consumption. And still, the same thing can be done a lot
+better with statically linked text, as even when there is no specific pattern
+as a shared library, there may be specific pattern as a private library
+of each program.
+
+Unshared shared libraries always use more real memory than statically
+linked ones.

     No, you haven't proven this one yet. The ONLY thing that has been proven
is that executables linked with shared libraries use more VIRTUAL memory than
statically linked executables, due to the fact that ALL of the text space of
a shared library gets loaded.  I haven't seen any facts to support the leap
to PHYSICAL memory, yet.

__________________________________________________________
Terry Laskodi		"There's a permanent crease
     of			 in your right and wrong."
Tektronix		Sly and the Family Stone, "Stand!"
__________________________________________________________



More information about the Comp.unix.internals mailing list