On Thu, 29 Oct 2009 21:25:59 +0100 Enrico Weigelt <weig...@metux.de> wrote:
> Russ Cox wrote: > > Hi, > > >> Assuming statically linked-in libraries are properly aligned, > >> we'll have lots of equal pages in the system, so the kernel could > >> find and automatically map them together. > > > > This is not true. When static libraries are linked into > > a target binary, only the necessary objects are taken, > > and all the symbol references are resolved (avoiding > > the need for relocation at load time), and the code is > > not position-independent. So even if they were "properly > > aligned", the bits of common code would be very small. > > Assuming PIC, of course ;-) > > My idea is to get rid of mmap() for shared libraries but w/o > loosing the code sharing behind the scenes. Pardon if this has come up before, but what about the greatly increased time taken to launch a shared-lib program? That's quite unsuitable for the typical unix commands intended to be used repeatedly, and produces unacceptable load times for apps depending on many libraries. I remember Gnome and KDE just before pre-linking was introduced, they weren't fun. Are you planning to incorporate pre-linking or something like it to offset this disadvantage? Shared libs are like object-oriented programming languages: they allow you to introduce much greater complexity to a single program but bring disadvantages too. There are other ways to deal with the problem such as (on Plan 9) breaking up the program into servers or commands + front end, a solution which may also greatly increase the flexibility of the application. -- Ethan Grammatikidis Those who are slower at parsing information must necessarily be faster at problem-solving.