Mono required by ubuntu-desktop

Scott James Remnant scott at ubuntu.com
Thu Aug 3 08:26:44 BST 2006


On Wed, 2006-08-02 at 23:15 -0700, Dan Kegel wrote:

> > We both seem to agree on a useful metric for minimum requirements;
> > namely currently available "entry level" PCs.  So that gives us a
> > ballpark maximum of 256MB of memory.
> 
> Let's look at that 256MB number a bit more carefully.
> Low-end PCs typically steal 64MB of that 256MB for video memory.
> So the budget is really 192MB, not 256MB.
> And ultra-low-end PCs have 128MB with 32MB stolen for video memory,
> so their budget is really 96MB!
> 
Not many PCs (at least not many I've ever encountered) steal the RAM for
the video card, this tends to be a laptop trick (I'm willing to be
corrected here, I've just not seen it in even the cheapest desktops).

> > On an i386, the base OS uses around 32MB of memory and the
> > desktop uses a further 80MB of memory ... so we're using about 112MB of
> > memory before we've got any user applications loaded.
> 
> On my dapper x86 system with 192MB or 512MB of RAM (booting
> with either size gives similar values), all root processes total
> 30MB of RSS (about what you quoted), but all user processes (not including
> firefox; all I have open is bash) total 163MB.  So that's 193MB of RAM before
> any user apps are loaded.   Yikes!  How did you measure that 80MB?
> I used the script
> ps augx | grep -v firefox | grep -v grep | grep $USER | sort -n +5 |
> awk '{sum += $6} END {print sum}'
> 
Ah, you've made the first mistake everyone does when talking about RAM
usage.  You've totalled up the memory footprint of each application
while failing to take into account that much of that memory is shared
and other parts are entirely backed by file:

RSS/VSZ/etc. are all nonsense figures that are merely useful for
comparison with other processes on the system -- you're not expected to
total them!

I measured it my looking at the actual pages of memory mapped to
particular processes and eliminating the duplicates.


Let's use bash as an example:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
scott    10170  0.0  0.1  11264  2424 pts/11   S    08:15   0:00 bash

So it's using somewhere between 2.4MB and 11MB according to this, but
not so...

0000000000400000    732K r-x--  /bin/bash
00000000005b6000     44K rw---  /bin/bash
00000000005c1000   1048K rw---    [ anon ]
00002aaaaaaab000     88K r-x--  /lib/ld-2.3.6.so
00002aaaaaac1000     12K rw---    [ anon ]
00002aaaaaac4000      4K r----  /usr/lib/locale/en_GB.utf8/LC_IDENTIFICATION
00002aaaaaac5000      4K r----  /usr/lib/locale/en_GB.utf8/LC_MEASUREMENT
00002aaaaaac6000      4K r----  /usr/lib/locale/en_GB.utf8/LC_TELEPHONE
00002aaaaaac7000      4K r----  /usr/lib/locale/en_GB.utf8/LC_ADDRESS
00002aaaaaac8000      4K r----  /usr/lib/locale/en_GB.utf8/LC_NAME
00002aaaaaac9000      4K r----  /usr/lib/locale/en_GB.utf8/LC_PAPER
00002aaaaaaca000      4K r----  /usr/lib/locale/en_GB.utf8/LC_MESSAGES/SYS_LC_MESSAGES
00002aaaaaacb000      4K r----  /usr/lib/locale/en_GB.utf8/LC_MONETARY
00002aaaaaacc000      4K r----  /usr/lib/locale/en_GB.utf8/LC_TIME
00002aaaaaacd000      4K r----  /usr/lib/locale/en_GB.utf8/LC_NUMERIC
00002aaaaaace000    204K r----  /usr/lib/locale/en_GB.utf8/LC_CTYPE
00002aaaaabc1000      4K rw---  /lib/ld-2.3.6.so
00002aaaaabc2000    308K r-x--  /lib/libncurses.so.5.5
00002aaaaac0f000   1024K -----  /lib/libncurses.so.5.5
00002aaaaad0f000     56K rw---  /lib/libncurses.so.5.5
00002aaaaad1d000      4K rw---    [ anon ]
00002aaaaad1e000      8K r-x--  /lib/libdl-2.3.6.so
00002aaaaad20000   1020K -----  /lib/libdl-2.3.6.so
00002aaaaae1f000      4K rw---  /lib/libdl-2.3.6.so
00002aaaaae20000   1140K r-x--  /lib/libc-2.3.6.so
00002aaaaaf3d000   1024K -----  /lib/libc-2.3.6.so
00002aaaab03d000     92K rw---  /lib/libc-2.3.6.so
00002aaaab054000     24K rw---    [ anon ]
00002aaaab05a000     32K r-x--  /lib/libnss_compat-2.3.6.so
00002aaaab062000   1024K -----  /lib/libnss_compat-2.3.6.so
00002aaaab162000      4K rw---  /lib/libnss_compat-2.3.6.so
00002aaaab163000     80K r-x--  /lib/libnsl-2.3.6.so
00002aaaab177000   1020K -----  /lib/libnsl-2.3.6.so
00002aaaab276000      4K rw---  /lib/libnsl-2.3.6.so
00002aaaab277000      8K rw---    [ anon ]
00002aaaab279000     36K r-x--  /lib/libnss_nis-2.3.6.so
00002aaaab282000   1024K -----  /lib/libnss_nis-2.3.6.so
00002aaaab382000      4K rw---  /lib/libnss_nis-2.3.6.so
00002aaaab383000     44K r-x--  /lib/libnss_files-2.3.6.so
00002aaaab38e000   1020K -----  /lib/libnss_files-2.3.6.so
00002aaaab48d000      4K rw---  /lib/libnss_files-2.3.6.so
00007fffff978000     84K rw---    [ stack ]
ffffffffff600000   8192K -----    [ anon ]
 total            19456K

It's actually got closer to 20MB mapped in, yet we can eliminate much of
this:

 - anything backed by file is easily swappable by the kernel and hangs
   out in the page cache, so it doesn't really count;  most of this
   stuff is shared libraries, locale data, etc.

 - the writable backed-by-file stuff is the overhead of having shared
   libraries in the first place, it's cheaper than statically linking
   binaries, and nobody's ever come up with a way of avoiding it

 - we can largely ignore the stack, unless it's ridiculously large

 - anything with no permissions and 8192K is a potential stack area, we
   can ignore that, it's not actually used just there in case

 - anything not writable can be ignored

Thus we're left with:

00000000005c1000   1048K rw---    [ anon ]
00002aaaaaac1000     12K rw---    [ anon ]
00002aaaaad1d000      4K rw---    [ anon ]
00002aaaab054000     24K rw---    [ anon ]
00002aaaab277000      8K rw---    [ anon ]

so bash's unique memory usage is actually 1096KB ... Everything else
should be collated and only counted once, the system only keeps one copy
of libc.so.6 in memory no matter how many applications count it towards
their VSZ/RSS

Scott
-- 
Scott James Remnant
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20060803/9fdd2921/attachment-0001.pgp 


More information about the ubuntu-devel mailing list