general question about lazy loading of shared libraries

Owen Taylor otaylor at redhat.com
Fri Nov 19 00:43:55 UTC 2004


On Thu, 2004-11-18 at 15:45 -0800, Roland McGrath wrote:
> Directly-linked libraries are always loaded immediately on startup.  
> Their PLT relocations may be deferred until used, but we always load the
> libraries themselves and run their initializers at startup time.

To be clear here, any pages of the library that don't need to
be modified to do relocations are only "loaded" in a bookkeeping
sense - ld.so tells the kernel to mmap the library, and the kernel
assigns the library a place in memory, but pages won't actually
be read off disk until they are used.

One of the big ways that prelink reduces startup time is being
making the set of pages that need to be loaded to do relocations
smaller.

I don't know an easy way to tell exactly what pages of the libraries 
you are using are touched and thus read off disk at start up... and it's
not even a well defined question - you can't tell if a page was 
read because of your app or because of another app.

You can get a general idea by looking at the display at top, roughly
speaking:

 VIRT - amount of memory your app has loaded in the bookkeeping sense
 RES - subset of VIRT in memory at the current time
 SHARE - subset of VIRT that some other application is also using

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20041118/3c03aea8/attachment.sig>


More information about the fedora-devel-list mailing list