unix RAM usage (Was: Re: OOo background color - Re: [GNHLUG] MerriLUG Nashua, Thur 20 Sep, OpenOffice Styles - for groff fans and real people too)

Kevin D. Clark kevin_d_clark at comcast.net
Thu Sep 27 17:07:53 EDT 2007


Bill McGonigle writes:

> So that brings up a question for those who understand unix: if I have  
> an emacs running, e.g.:
> 
>      PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD   
> RSIZE  VSIZE
>    29806 emacs-i386   0.0%  0:00.03   1    15    25  1.15M  3.75M   
> 2.84M  47.0M
> 
> the virtual size is 47M, but the shared and resident sizes rarely  
> change from their combined 8MB (it's true! - I aggravated our  
> sysadmin in college by running emacs on an 8MB machine (that served  
> the whole department) - it took 8MB then as well).
> 
> I understand that there's stuff in that 47MB space that might need to  
> be swapped in, but since it so rarely does, it is all just pre- 
> allocated buffers that are never used?  There's a concept here I  
> don't really understand, apparently.

I think that it is very likely that the "discrepancy" between the 8
and 47MB is due in large part to pages that are occupied by shared
libraries.

The figure of "47.0M" represents how much memory it would take to hold
the entire process in memory if it was the only thing running on the
machine.  But, you need to remember that in these modern times we have
memory paging and shared libraries.  So, while it might take "47.0M"
to run emacs-i386, a lot of that space comes from shared libraries,
and a lot of the code segments from those libraries can be shared by
other processes that are running on the system...

So, when I see your output, I guess that the "ps" output that you
include was taken from a BSD-flavored machine, probably MacOS, and
when I see RSHRD, I think to myself that 3.75M of your emacs processes
shared-memory code-space is resident in RAM, and that there is likely
a lot of stuff in that total 47.0M that is paged out and not getting
used a lot.

Does this help?

Regards,

--kevin

PS  keywords: ps, ldd, pmap, proc, rss, vsz

-- 
GnuPG ID: B280F24E              God, I loved that Pontiac.
alumni.unh.edu!kdc                   -- Tom Waits


More information about the gnhlug-discuss mailing list