Shared libraries are not necessary

terryl at sail.LABS.TEK.COM terryl at sail.LABS.TEK.COM
Sat Jun 1 08:37:00 AEST 1991


In article <264 at titccy.cc.titech.ac.jp> mohta at necom830.cc.titech.ac.jp (Masataka Ohta) writes:
+Now, perhaps, it is time to show that shared libraries often increase
+memory consumption.

     Yes, I actually do agree with what you said above; unfortunately, you
really haven't shown what you claim.

+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.
Here's a partial ps listing of a local workstation running X:

   181 ?	0:00 xdm
   184 ?	2:04 X
   191 ttyp1    0:01 xterm
   192 ?        0:00 sh
   201 ?        0:00 sh
   211 ?        0:01 xterm
   214 ?        0:10 mwm
   252 ?        0:32 xterm
   253 ?        0:00 xterm
   255 ?       68:19 xclock
   256 ?        0:05 xeyes
   261 ttyp4    0:00 csh
   258 ttyp3    0:01 csh
   259 ttyp2    0:01 csh
  1783 ?        0:14 rlogind
  1784 ttyp5    0:01 csh
  1965 ttyp5    0:00 ps
  1043 ttyp7    0:01 csh
  1040 ?        0:03 xterm
  1945 ttyp2    0:45 gdb

I count 5 different X applications running (xdm, xterm, mwm, xclock, xeyes),
plus the server (listed as X in the above listing).

+In article <4757 at skye.ed.ac.uk> richard at aiai.UUCP (Richard Tobin) writes:
+
+>bute% ls -l xvserver*
+>-rwxr-xr-x  1 richard    139264 May 22 21:28 xvserver*
+>-rwxr-xr-x  1 richard   1286144 Mar 11 18:01 xvserver.static*
+>bute% size xvserver*
+>text    data    bss     dec     hex
+>32768   8192    5360    46320   b4f0    xvserver
+>942080  131072  16376   1089528 109ff8  xvserver.static
+
+>How much is really shared?  Obviously it depends on what other programs
+>are being run.  But we might well run several different xview programs
+>simultaneously, and the saving in disk space is also substantial.
+
+I asked Richard the size of library shared. And lines below are his reply:
+:bute% size /usr/local/lib/lib{xview,olgx,X11}.so* /usr/lib/libc.so*
+:text    data    bss     dec     hex
+:868352  73728   2544    944624  e69f0   /usr/local/lib/libxview.so.3.0
+:40960   8192    0       49152   c000    /usr/local/lib/libolgx.so.3.0
+:180224  24576   3584    208384  32e00   /usr/local/lib/libX11.so.4.2
+:442368  16384   0       458752  70000   /usr/lib/libc.so.1.5
+Thank you, Richard.
+
+According to his data, total text space required for xvserver is:
+	940Kbytes without shared libraries
+and
+	1560Kbytes with shared libraries.

     You make one strange assumption here, and I'll ask you like you asked
Richard: 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.

+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.



More information about the Comp.unix.internals mailing list