9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: geoff@collyer.net
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Virtual memory & paging
Date: Mon,  4 Feb 2002 02:38:16 -0800	[thread overview]
Message-ID: <20020204103944.36F5419A27@mail.cse.psu.edu> (raw)

There isn't a copy of the entire C library in every binary.  There is
a copy of each library routine called, directly or indirectly, by the
program in question.

Sharing of instructions is done at the granularity of process text
segments, as in V6 or V7 Unix.  The text segment of a process that
forks is shared between parent and child by page mapping.  Also,
running (via exec) a program multiple times concurrently causes the
(pure) text segment to be shared by page mapping across those
processes.  So all copies of rc and on a machine should share a text
segment.

Given that degree of sharing, the low cost of RAM, and the increase in
OS complexity, slowness and insecurity in the implementations of
dynamic libraries that I've seen, I don't see a need for dynamic
libraries.  (Remember that the real impetus for adding them to Unix
was X11 and its big and badly-factored libraries, which most of us
aren't blessed with.)  My terminal has 115 processes; all but 4 of
them share their text segment with at least one other process, usually
more.  74 of them are instances of rio, Mail, rc, acme, listen,
plumber and samterm.  A CPU server has 141 processes; all but 2 share
text.  80 of them are listen, another 21 are rc, exportfs, kfs, dns
and consolefs.  A quick sampling suggests that Plan 9 programs are
typically smaller than FreeBSD/386 programs even with shared
libraries.  Here are some FreeBSD sizes:

: unix; size /bin/cat /bin/ed /usr/bin/awk /usr/X11/bin/sam
   text    data     bss     dec     hex filename
  54188    4324    9760   68272   10ab0 /bin/cat
 122835    8772   81920  213527   34217 /bin/ed
 135761    4772   15756  156289   26281 /usr/bin/awk
  52525    1412   53448  107385   1a379 /usr/X11/bin/sam

Of those, awk and sam use shared libraries.  The corresponding Plan 9
sizes are:

; cd /bin; size cat ed awk sam
15996t + 2208d + 944b = 19148	cat
45964t + 4212d + 41232b = 91408	ed
114731t + 35660d + 12040b = 162431	awk
86574t + 7800d + 66240b = 160614	sam

and the Plan 9 programs cope with Unicode and UTF.



             reply	other threads:[~2002-02-04 10:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-04 10:38 geoff [this message]
2002-02-04 11:16 ` Boyd Roberts
2002-02-04 11:45 ` Boyd Roberts
2002-02-04 17:10   ` Andrew Simmons
2002-02-05 11:17     ` Boyd Roberts
2002-03-30  4:26   ` Richard Maxwell Underwood
2002-03-30  5:46     ` [9fans] Uncluttering Richard Maxwell Underwood
2002-02-05  9:53 ` [9fans] Virtual memory & paging Thomas Bushnell, BSG
2002-02-05 16:06   ` Ronald G Minnich
  -- strict thread matches above, loose matches on Subject: below --
2002-02-15 14:32 Richard Uhtenwoldt
2002-02-16 21:56 ` Ronald G Minnich
2002-02-05 10:57 geoff
2002-02-05 11:37 ` Boyd Roberts
2002-02-05 14:01 ` david presotto
2002-02-04 11:03 Fco.J.Ballesteros
2002-02-04 10:59 forsyth
2002-02-04 10:30 forsyth
2002-02-03 23:08 geoff
2002-02-03 20:26 ` Andrew Simmons
2002-02-04 16:15   ` Ronald G Minnich
2002-02-04  6:21 ` Richard Uhtenwoldt
2002-02-03 21:53 presotto
2002-02-03 22:36 ` Andrew Simmons
2002-02-03 21:21 rob pike
2002-02-04 21:46 ` skipt
2002-02-04 22:11   ` Ronald G Minnich
     [not found]   ` <Pine.LNX.4.33.0202041510540.4327-100000@snaresland.acl.lan l.gov>
2002-02-05  1:30     ` skipt
2002-02-05 15:32       ` Ronald G Minnich
2002-02-03 21:12 andrey mirtchovski
2002-02-03 21:01 Andrew Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020204103944.36F5419A27@mail.cse.psu.edu \
    --to=geoff@collyer.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).