material about library loading

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
mcheung63
Member
Member
Posts: 175
Joined: Thu Jun 22, 2006 8:33 am
Location: Hong Kong
Contact:

material about library loading

Post by mcheung63 »

Hi All
Any PDF or website that talk about how library load the shared library? I want to know what strategy make linux remove the shared library from the memory.
thanks
from Peter ([email protected])
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Re: material about library loading

Post by mathematician »

I would imagine that, for each library, it keeps a count of how many programs there are in memory which need it. Every time one such program is loaded it increments the count, and every time one such program terminates, it decrements the count. When the count gets down to zero it removes the library from memory. Unless it is being used by the OS itself of course.
The continuous image of a connected set is connected.
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: material about library loading

Post by yemista »

how would the dynamic linking work? what I mean is, how are programs, compiled against that library, to know where the library is gonna end up being loaded?
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Re: material about library loading

Post by frank »

This site http://www.iecc.com/linker/linker10.html seems to have lots of information about ELF dynamic linking.
User avatar
mcheung63
Member
Member
Posts: 175
Joined: Thu Jun 22, 2006 8:33 am
Location: Hong Kong
Contact:

Re: material about library loading

Post by mcheung63 »

thank you for the idea
from Peter
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: material about library loading

Post by gravaera »

yemista wrote:how would the dynamic linking work? what I mean is, how are programs, compiled against that library, to know where the library is gonna end up being loaded?
I've only read about half of the ELF spec so far, and only the bits that would help me load an executable, but form what I remember about Dynamic Linking, the ELF file provides a path to the library it requires. I can't remember whether it provides an absolute address to the symbol/function it wants, or whether it provides simply the symbol name either.

Generally, what I picked up was that the OS resolves the symbols, etc, and points the CPU to the right function based on the Symbol Tables and DYNSYM sections.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Post Reply