[comp.unix.admin] Memory usage questions

beauchem@roselin.DMI.USherb.CA (Denis Beauchemin) (05/08/91)

Hi there,

I am trying to compute the amount of main memory used by some processes and I
don't know exactly what to look at in the ps output.  When I do a "ps aux" I
get the SZ and RSS fields that detail memory usage.  Is one a subset of the
other or do I have to add them up to get the real picture?

What's the memory requirements of SunOS 4.1.1 on a SPARCstation 2?  How can I
determine it?  It must be related to the kernel I am using...

Thanks for answering these questions!

-- 
=== Denis Beauchemin,  === beauchem@DMI.USherb.CA ===
=== Dir. R&D           =================================
=== Sisca Informatique === Sun, AT&T and networks  ===
=== (819) 564-4003.    ==============================

barmar@think.com (Barry Margolin) (05/09/91)

In article <1991May8.151630.12279@DMI.USherb.CA> beauchem@roselin.DMI.USherb.CA (Denis Beauchemin) writes:
>I am trying to compute the amount of main memory used by some processes and I
>don't know exactly what to look at in the ps output.  When I do a "ps aux" I
>get the SZ and RSS fields that detail memory usage.  Is one a subset of the
>other or do I have to add them up to get the real picture?

It's a little more complicated than that.

SZ is the size of the data and stack segments of the process.  This is
basically the amount of swap space that is being used (the text segment is
paged directly out of the object file and shared libraries).

RSS is the Resident Set Size.  This is the amount of physical memory that
is being used by this process, i.e. the number of kbytes that are paged in
from disk (in any segment).  I'm not sure how this accounts for memory
pages that are in use by multiple processes (e.g. multiple processes paging
their text segment from the same binary).
-- 
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar

panos@tigger.Colorado.EDU (Panos Tsirigotis) (05/09/91)

In article <1991May8.170752.13521@Think.COM> barmar@think.com writes:
>In article <1991May8.151630.12279@DMI.USherb.CA> beauchem@roselin.DMI.USherb.CA (Denis Beauchemin) writes:
>>I am trying to compute the amount of main memory used by some processes and I
>>don't know exactly what to look at in the ps output.  When I do a "ps aux" I
>>get the SZ and RSS fields that detail memory usage.  Is one a subset of the
>>other or do I have to add them up to get the real picture?
>
>It's a little more complicated than that.
>
>SZ is the size of the data and stack segments of the process.  This is
>basically the amount of swap space that is being used (the text segment is
>paged directly out of the object file and shared libraries).

SZ <= amount of swap space used because of dynamic linking. The text segment
is mapped in from the object file using MAP_PRIVATE mapping. Then
ld.so does the linking causing some pages to change causing copy-on-write's.
The changed pages will be backed up in the swap space. The non-changed
pages will be backed up by the object file.

Panos

-- 
----------------------------------------------------
| Panos Tsirigotis, CS grad                        |
| Computer Science Dept., U. of Colorado @ Boulder |
| Boulder, CO 80309                                |