1752815 Members
6017 Online
108789 Solutions
New Discussion

Re: RSS vs VSS

 
Wagner Villela
Advisor

RSS x VSS

Dear friends,

 

Any way to get use of RSS memory by a process with not via glance? I think "ps" gets information about VSS use by an process and it comes with some shared area included, right? I try:

 

#  UNIX95= ps -e -o pid,sz,pcpu,ruser,args

 

 PID        SZ      %CPU RUSER    COMMAND
29622    2601    0      avb2020  oracleceeec
19029     24       0        avb2012  AVB_pcserv
19785   2513     0      avb2018  oracleceeec
28402     23        0        avb2010  AVB_pcserv
28621  2491     0      avb2004  oracleceeec

 

Colunm "SZ" gets VSS information and not RSS information, right?

 

Thanks for all

 

Wagner
9 REPLIES 9
Dennis Handly
Acclaimed Contributor

Re: RSS vs VSS

>Column "SZ" gets VSS information and not RSS information?

 

It's hard to be sure with ps(1).  It mentions sz and vsz:

sz  The size in physical pages of the core image of the process, including text, data, and stack space.

vsz The size of the process in (virtual) memory in kilobytes (1024 byte units).

 

But vsz does sound like it gets VSS.  Whether that means sz is RSS, I'm not sure.

Wagner Villela
Advisor

Re: RSS vs VSS


@Dennis Handly wrote:

>Column "SZ" gets VSS information and not RSS information?

 

It's hard to be sure with ps(1).  It mentions sz and vsz:

sz  The size in physical pages of the core image of the process, including text, data, and stack space.

vsz The size of the process in (virtual) memory in kilobytes (1024 byte units).

 But vsz does sound like it gets VSS.  Whether that means sz is RSS, I'm not sure.


Thanks, Dennis.

 

I'm still searching for more details.

 

Glance information is ok, but i need to sum all process of a given user and output format of "ps" is perfect  for this need. Unfortunately seens that information is in VSS sizes.

Wagner
Dennis Handly
Acclaimed Contributor

Re: RSS vs VSS

>I need to sum all process of a given user. Unfortunately seems that information is in VSS sizes.

 

From the source, the SZ and VSZ info comes from:

struct __pst_status {
SZ:
        _T_LONG_T pst_dsize;    /* # real pages used for data
        _T_LONG_T pst_tsize;    /* # real pages used for text
        _T_LONG_T pst_ssize;    /* # real pages used for stack

VSZ:
        _T_LONG_T pst_vtsize;   /* # virtual pages used for text
        _T_LONG_T pst_vdsize;   /* # virtual pages used for data
        _T_LONG_T pst_vssize;   /* # virtual pages used for stack
        _T_LONG_T pst_vshmsize; /* # virtual pages used for shared memory
        _T_LONG_T pst_vmmsize;  /* # virtual pages used for mem-mapped files
        _T_LONG_T pst_vusize;   /* # virtual pages used for U-Area & K-Stack
        _T_LONG_T pst_viosize;  /* # virtual pages used for I/O dev mapping
        _T_LONG_T pst_vrsesize; /* # virtual pages used for RSE stack

 

top:  _T_LONG_T pst_rssize;  /* resident set size for process (private pages)

Wagner Villela
Advisor

Re: RSS vs VSS


@Dennis Handly wrote:

>I need to sum all process of a given user. Unfortunately seems that information is in VSS sizes.

 

From the source, the SZ and VSZ info comes from:

struct __pst_status {
SZ:
        _T_LONG_T pst_dsize;    /* # real pages used for data
        _T_LONG_T pst_tsize;    /* # real pages used for text
        _T_LONG_T pst_ssize;    /* # real pages used for stack

Dennis

 

You mean that the information from "ps" and showed in "SZ" column is in fact a RSS memory use?

 

Is a bit confused to me, because if i run a "ps" and do a sum of all values of "SZ" column, the final result is much more than physical memory of the machine.

 

By the way, this machine works with a very, very high load and perform swap mostly part of time. This total of "SZ" that exceds physical memory may be because machine does swap?

 

Thank you very much

Wagner
Dennis Handly
Acclaimed Contributor

Re: RSS vs VSS

>You mean that the information from "ps" and showed in "SZ" column is in fact a RSS memory use?

 

Well, it isn't, why have both:

_T_LONG_T pst_dsize;    # real pages used for data

_T_LONG_T pst_vdsize;   # virtual pages used for data

 

>if I run a "ps" and do a sum of all values of  "SZ", the final result is much more than physical memory of the machine.

 

The text size is shared.

 

>this machine works with a very, very high load and perform swap mostly part of time.

 

Then why bother measuring it if it is that bad?  ;-)

 

This total of "SZ" that exceeds physical memory may be because machine does swap?

 

That and shared text and using VSS may explain it.

Wagner Villela
Advisor

Re: RSS vs VSS


@Dennis Handly wrote:

>You mean that the information from "ps" and showed in "SZ" column is in fact a RSS memory use?

 Well, it isn't, why have both:

_T_LONG_T pst_dsize;    # real pages used for data

_T_LONG_T pst_vdsize;   # virtual pages used for data

 

>if I run a "ps" and do a sum of all values of  "SZ", the final result is much more than physical memory of the machine.

 

The text size is shared.

>this machine works with a very, very high load and perform swap mostly part of time.

 

Then why bother measuring it if it is that bad?  ;-)

This total of "SZ" that exceeds physical memory may be because machine does swap?

 

That and shared text and using VSS may explain it.



Thanks, Dennis.

 

If you remember some magic way to sum all RSS values of running process, please let me know.

 

Thanks again.

Wagner
Dennis Handly
Acclaimed Contributor

Re: RSS vs VSS

>magic way to sum all RSS values of running process

 

You can redirect the top output with "-f file" and scan that.

Wagner Villela
Advisor

Re: RSS vs VSS


@Dennis Handly wrote:

>magic way to sum all RSS values of running process

 You can redirect the top output with "-f file" and scan that.


Hummm.....

 

top -d 1 -n 1024 -f lix1

 

Output works fine. But, again, in "top" manual we can read:

 

**** about RES column ****

 

RES

 

Resident size of the process in kilobytes.  The resident size information is, AT BEST, AN APPROXIMATE VALUE.

 

Any way to know if it can represent a big difference in values?

 

Thanks again. Very useful tip.

Wagner
Dennis Handly
Acclaimed Contributor

Re: RSS vs VSS

>Any way to know if it can represent a big difference in values?

 

I assume by approximate is that it doesn't account for shared regions?