Operating System - HP-UX
1833012 Members
2915 Online
110048 Solutions
New Discussion

Re: Shared and private memory used by process

 
Ninad_1
Honored Contributor

Shared and private memory used by process

Hi,

How can I determine the private and shared memory used by a process ? I have seen some metrics like PROC_MEM_RES but it must be showing provate+shared memory.Can anyone guide me on this?

Thanks,
nad
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: Shared and private memory used by process

Glance/gpm has a good gui that lets you drill into a process and see a lot of interesting data.

Its a pay for add in but probably worth it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
RAC_1
Honored Contributor

Re: Shared and private memory used by process

I do not think it would not be possible to differntiate between private and shared.

There are two utilities that come to my mind.

shminfo tool. Get it from floowing link
ftp://ftp.itrc.hp.com/

use of ipcs command.

man ipcs for details.
ipcs -moba
There is no substitute to HARDWORK
Sameer_Nirmal
Honored Contributor

Re: Shared and private memory used by process

Private memory of a process will have stack and data objects.
Shared memory of a process will have shared text , shared memory and shared library objects.

Glance gives good picture of a whole process structure. You can check the private memory of a process using PROC_MEM_PRIVATE_RES metric. It shows the valuse in KB and you have to enable "Process Memory Region" option in the Glance GUI. For process shared memory , check PROC_MEM_SHARED_RES metric , value in KB.

In Text based Glance, you can see this information for a process noting its PID
s (Select key ) -> PID -> M

Raj D.
Honored Contributor

Re: Shared and private memory used by process

Hi Ninad ,

To check shared memory : # ipcs -p -m
and for details can be checked with glance.

Also use ps -ef to see the top processes using private memory:
ps -ael | sort -r -k10 | head -10

Cheers,
Raj.

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Ninad_1
Honored Contributor

Re: Shared and private memory used by process

Thanks all for your inputs.
I already have glance. I tried using the metrics PROC_MEM_PRIVATE_RES & PROC_MEM_SHARED_RES but it shows me "na" in both the fields. What could be the problem ?
I have B3701AA C.03.71.00 HP GlancePlus/UX Pak for s800 11.0 on my HP-UX 11.00 box.
Have you seen values for the above PROC params on your machines ?
Also I am aware you can see shared mem segments using ipcs but what I want is for each process what is the private and shared resident memory.

Sameer,
Great to hear from u. Pls mail me at ninaddate@indiatimes.com

Regs,
Ninad
Sameer_Nirmal
Honored Contributor

Re: Shared and private memory used by process

Ninad,

You should able to see values for both. I am using Glance 2.40 on HP-UX 11.0 and 2.61 on HP-UX 11.11 . I could see these values .

I guess you might have looked at it once only. sometimes these values couldn't be obtained by Glance , hence it will show "na" in those field. Whenever it can, you should see the values.

Sandman!
Honored Contributor

Re: Shared and private memory used by process

Ninad,

Follow RAC's suggestion and download the shminfo tool from ftp://ftp.itrc.hp.com/

I'ave used it in the past and still do from time to time and its invaluable in showing the system shared memory map and for correlating those regions to the various processes on the system.

Another tool would be ipcs though various options and switches to the shminfo tool will let you duplicate its output.

cheers!
Bill Hassell
Honored Contributor

Re: Shared and private memory used by process

Shared memory is almost impossible to assign to a specific program. ipcs can show you the creator's PID and the PID of the last program to access a shared memory segment. But there are no rules that prevent the creator from leaving the segment and terminating, thus an orphaned segment is just left in RAM.

Get a copy of shminfo from:
ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/programs/shminfo/



Bill Hassell, sysadmin