Are shared libraries shared because they are loaded from the same file on disk, or are they shared because they are loaded into memory once and everyone shares that same area of memory? In Linux are they loaded once and mapped virtually into every process space? How does this work?
EDIT: When I say shared I think I mean dynamically linked, but if there is a difference please let me know.
Generally the latter (although
$LD_PRELOADchanges this; see theld.so(8)man page, ENVIRONMENT section for details). The CPU TLBs are used to map the libraries’ pages into the applications’ process space.