Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!kddlab!cs.titech!titccy.cc.titech!necom830!mohta From: mohta@necom830.cc.titech.ac.jp (Masataka Ohta) Newsgroups: comp.unix.internals Subject: Re: Shared libraries are not necessary Keywords: ISC i386 shared libraries Message-ID: <275@titccy.cc.titech.ac.jp> Date: 3 Jun 91 02:01:11 GMT References: <201@titccy.cc.titech.ac.jp> <1991May17.053735.2123@kithrup.COM> <210@titccy.cc.titech.ac.jp> <1991May21.170435.22610@kithrup.COM> <223@titccy.cc.titech.ac.jp> <4757@skye.ed.ac.uk> <264@titccy.cc.titech.ac.jp> <9613@sail.LABS.TEK.COM> Sender: news@titccy.cc.titech.ac.jp Organization: Tokyo Institute of Technology Lines: 77 In article <9613@sail.LABS.TEK.COM> terryl@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. Moreover, along this discussion, several people said that they are using X just because they want multiple terminal windows at once. >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. And, even you have not yet shown the result of 'ldd' and 'size'. Without that, you can say nothing. Please be technical. > 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. >+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. 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. 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. Judging from the measurement result of the REAL system: >+According to his data, total text space required for xvserver is: >+ 940Kbytes without shared libraries >+and >+ 1560Kbytes with shared libraries. the ratio is, perhaps, near 1:1.5. Masataka Ohta