* [9fans] automatic page sharing
@ 2009-04-18 17:05 Enrico Weigelt
2009-04-18 17:46 ` tlaronde
2009-04-28 22:19 ` Russ Cox
0 siblings, 2 replies; 10+ messages in thread
From: Enrico Weigelt @ 2009-04-18 17:05 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Hi folks,
some time ago, we had several discussions about shared libraries,
mmap(), etc. One of the major arguments for shared libraries is
to share code pages between processes - and the traditional *nix
approach to do so is mmap() (at least on the systems I know).
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.
What do you think about this approach ?
Would it be hard to implement this ?
cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/
cellphone: +49 174 7066481 email: info@metux.de skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] automatic page sharing
2009-04-18 17:05 [9fans] automatic page sharing Enrico Weigelt
@ 2009-04-18 17:46 ` tlaronde
2009-04-28 22:19 ` Russ Cox
1 sibling, 0 replies; 10+ messages in thread
From: tlaronde @ 2009-04-18 17:46 UTC (permalink / raw)
To: weigelt, Fans of the OS Plan 9 from Bell Labs
On Sat, Apr 18, 2009 at 07:05:07PM +0200, Enrico Weigelt wrote:
>
> 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.
>
Well that's one of the 3 classical options:
1) static linking.
2) static shared libraries [your proposal]
3) dynamically linked shared libraries.
For what is worth, you can find explanations in "Linkers and Loaders" by
John R. Levine, Morgan Kaufmann, ISBN 1-55860-496-0.
HTH,
--
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] automatic page sharing
2009-04-18 17:05 [9fans] automatic page sharing Enrico Weigelt
2009-04-18 17:46 ` tlaronde
@ 2009-04-28 22:19 ` Russ Cox
2009-10-29 20:25 ` Enrico Weigelt
1 sibling, 1 reply; 10+ messages in thread
From: Russ Cox @ 2009-04-28 22:19 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> 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.
You'll see this if you run an experiment and compare
two big binaries for common code sequences. They'll
be there, but nothing nearly as big as a page.
Russ
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] automatic page sharing
2009-04-28 22:19 ` Russ Cox
@ 2009-10-29 20:25 ` Enrico Weigelt
2009-10-29 23:25 ` Ethan Grammatikidis
0 siblings, 1 reply; 10+ messages in thread
From: Enrico Weigelt @ 2009-10-29 20:25 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
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.
cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/
cellphone: +49 174 7066481 email: info@metux.de skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] automatic page sharing
2009-10-29 20:25 ` Enrico Weigelt
@ 2009-10-29 23:25 ` Ethan Grammatikidis
2009-10-30 9:57 ` Gorka Guardiola
0 siblings, 1 reply; 10+ messages in thread
From: Ethan Grammatikidis @ 2009-10-29 23:25 UTC (permalink / raw)
To: 9fans
On Thu, 29 Oct 2009 21:25:59 +0100
Enrico Weigelt <weigelt@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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] automatic page sharing
2009-10-29 23:25 ` Ethan Grammatikidis
@ 2009-10-30 9:57 ` Gorka Guardiola
0 siblings, 0 replies; 10+ messages in thread
From: Gorka Guardiola @ 2009-10-30 9:57 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Fri, Oct 30, 2009 at 12:25 AM, Ethan Grammatikidis
<eekee57@fastmail.fm> wrote:
> On Thu, 29 Oct 2009 21:25:59 +0100
> Enrico Weigelt <weigelt@metux.de> wrote:
> Pardon if this has come up before, but what about the greatly
> increased time taken to launch a shared-lib program? That's quite
Not that much if your loaded caches the binaries of the programs (as
we do) and they
are small and for really shared state you have filesystems which
stay running.
--
- curiosity sKilled the cat
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <<20091029232535.af075d27.eekee57@fastmail.fm>]
[parent not found: <<599f06db0910300257v4fef540eid5626e2ba7c798ec@mail.gmail.com>]
end of thread, other threads:[~2009-10-30 14:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-18 17:05 [9fans] automatic page sharing Enrico Weigelt
2009-04-18 17:46 ` tlaronde
2009-04-28 22:19 ` Russ Cox
2009-10-29 20:25 ` Enrico Weigelt
2009-10-29 23:25 ` Ethan Grammatikidis
2009-10-30 9:57 ` Gorka Guardiola
[not found] <<20091029232535.af075d27.eekee57@fastmail.fm>
2009-10-30 0:22 ` erik quanstrom
2009-10-30 0:39 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
2009-10-30 10:11 ` Richard Miller
[not found] <<599f06db0910300257v4fef540eid5626e2ba7c798ec@mail.gmail.com>
2009-10-30 14:14 ` erik quanstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).