Subject: Re: Dynamically linked programs
To: Paulo Alexandre Pinto Pires <email@example.com>
From: Jason R Thorpe <firstname.lastname@example.org>
Date: 08/27/2002 23:04:16
On Wed, Aug 28, 2002 at 02:50:55AM -0300, Paulo Alexandre Pinto Pires wrote:
> USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
> pappires 562 0.0 0.0 72 72 p2 S+ 1:55AM 0:00.00 ./test-static
> pappires 565 0.0 0.1 16 340 p2 S+ 1:55AM 0:00.00 ./test-shared
> ps(1) shows a resident segment size for the shared version almost five
> times as large as that of the static version. The virtual space, on
> the other hand, is 4.5 times smaller.
> Which one matters? Does RSS count shared pages multiple times, for
> each process that depends on a shared library (here, only libc)?
A couple of things are happening:
(1) Some pmap modules count page tables as "resident" pages.
(2) The resident page count is actually a count of page mappings,
and so shared pages are, in fact, being counted multiple times.
In fact, an all-dynamic system is likely to save memory, since e.g. there
won't be multiple copies of the stdio code in memory.
-- Jason R. Thorpe <email@example.com>