Operating System - HP-UX
1829587 Members
1680 Online
109992 Solutions
New Discussion

Process memory - doesn't make sense

 
SOLVED
Go to solution
Alun  Territt
Advisor

Process memory - doesn't make sense

Hi everyone,

I have a question about process memory.

I got the sz column from ps and multiplied it
by the page size (4096) to get total memory
usage for a process.

But, this figure is always larger than either
the RSS or Virtual SS from Glance.

ie
From GlancePlus :

Process Name : PID: RSS: VSS:
ora_smon_AHSTD 10582 7.4mb 21.4mb

From ps :

PID sz*4096 Process Name :
10582 35.5 MB ora_smon_AHSTD

You see that the value from ps is always
MUCH larger than Glance.

Now, I've read the docs in Glance where it
does discuss this. And it mentions that
Glance takes account of the Shared memory
areas as well as the private data areas.

So, shouldn't the figure from Glance be
LARGER than ps?

And, in the end, which value do I believe?

If I sum up all the sz*4096 values from ps,
I get a figure which is MUCH larger than
the physical memory on our hp-ux box.
This leads me to think that the value from
ps is worthless. But then why publish the
info at all?

Confused.

Paul Stuart
7 REPLIES 7
harry d brown jr
Honored Contributor
Solution

Re: Process memory - doesn't make sense

In glance, take these numbers down:

Data RSS
Text RSS
Stack RSS

Add them up.

Mutliply by 1024.

Take your ps 'sz' number and multiply by 4096.

Divide that by 1024, and magic happens!

If not, then post your ps and glance numbers plus the output from kmtune.

live free or die
harry d brown jr
Live Free or Die
Alun  Territt
Advisor

Re: Process memory - doesn't make sense

Hi Harry,

How do I get those values? (data,text
and stack)

I used the metrics :

proc_region_res,
proc_region_res_text,
proc_region_res_stack

in a .syntax file, but it appears to
return a whole list of values for each
process.

Paul S
harry d brown jr
Honored Contributor

Re: Process memory - doesn't make sense



gpm > reports > process list > select process > process memory regions.

Its the first column of the memory regions, first three rows.

live free or die
harry d brown jr
Live Free or Die
harry d brown jr
Honored Contributor

Re: Process memory - doesn't make sense

If you are STUCK using "glance" and NOT gpm, then:

glance
s
PID
M

at the bottom of the screen note the line that looks like this:

Text RSS/VSS:388kb/416kb Data RSS/VSS:1.3mb/3.1mb Stack RSS/VSS: 48kb/ 48kb

take the first "set" of numbers: 388 from text, 1.3mb from Data, 48kb from Stack

on my system thats 388kb, 1.3mb, and 48kb

the conversion of 1.3mb to kb is NOT exact, thus you could be off a little, which is why I use gpm.

live free or die
harry d brown jr
Live Free or Die
Alun  Territt
Advisor

Re: Process memory - doesn't make sense

OK, so I have :

Text RSS/VSS: 19mb/ 30mb
Data RSS/VSS:560kb/1.0mb
Stack RSS/VSS: 24kb/ 64kb
Shmem RSS/VSS: 41mb/ 46mb
Other RSS/VSS:3.3mb/7.3mb

And ps says :

10691 19.1 MB ora_ckpt_ITUAT

So that makes sense to me. Great!

The only thing is, when I run my Glance syntax file (in adviser_only), i say :

PRINT proc_proc_name, proc_proc_id, proc_mem_res

I get :

ora_ckpt_ITUAT 10691 6.3mb

How come this figure doesn't align with any of the other stuff we've come up with?

Paul
Emil Velez
Honored Contributor

Re: Process memory - doesn't make sense


Shared memory and shared memory regions are special. In glance for example if a process has a 10 MB shared memory region and 4 other processes are attached to that shared memory. Therefore 5 processes are attached to the shared memory. So 10MB/5 = 2

So each process in glance is charged for only 2 MB of that shared memory in glance.

Its buried somewhere in the metric descriptions. I found it somewhere once.

here is a excerpt of a file I have I hope it clears this up. I kept this because it was a good explination of what you are asking.

Emil Velez

-----------------------------------------------
Resident memory (RSS) is calculated as

RSS = sum of private region pages + (sum of shared region pages / number of references)

The number of references is a count of the number of attachments to the memory region. Attachments, for shared regions, may come from several processes sharing the same memory, a single process with multiple attachments, or combinations of these."

This then means that the PROC_MEM_RES metric can be useful for summing up process memory usage and comparing it with the APP_MEM_RES metric. It also means, though, that there will most likely be a discrepancy if we compare the PROC_MEM_RES value to the "SZ" value from the ps -el command, as that does not utilize the reference count for shared segments in its calculations. It also means that we cannot use this metric to answer the question that was posed earlier in this paper; "How much memory would this process be using if it were the only process running on the system?"

harry d brown jr
Honored Contributor

Re: Process memory - doesn't make sense