Operating System - HP-UX
1833739 Members
2727 Online
110063 Solutions
New Discussion

HP-UX process VM size: discriminate private and shared memory...

 
Konc
Occasional Contributor

HP-UX process VM size: discriminate private and shared memory...

Maybe a naive question, but who knows how to precisely know the memory consumed by a single user (that is counting only once the shared memory used by different processes)?
Thanks
4 REPLIES 4
Stefan Farrelly
Honored Contributor

Re: HP-UX process VM size: discriminate private and shared memory...

gpm is what you want (Glance). The process list report shows all processes and their memory usage, but you can then simply double click on a process to drill down and view its memory regions so you can see its shared RSS size and then deduct the shared RSS Size to get its effective size, or for all processes with the same name only count this shared (memory) RSS size once for all of them.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Bill Hassell
Honored Contributor

Re: HP-UX process VM size: discriminate private and shared memory...

Unix memory usage is a very complex process. As you mentioned, shared memory is difficult to assign to a given process, and considering the number of different ways a process may be started (cron, rpc, network client/server tasks, threads), accurately assigning memory to a single user is virtually impossible. For given user ID, you can get a rough idea (which is likely all that you need) by using ps:

UNIX95= ps -u joan -o vsz,ruser,pid,args |sort -rn

This shows all processes owned by the real user joan, showing the virtual size in Kbytes in descending order.


Bill Hassell, sysadmin
Mike Stroyan
Honored Contributor

Re: HP-UX process VM size: discriminate private and shared memory...

The pstat_procvm function can give you all the information you need to do that. The attached program uses a reference count of the number of processes that map each region. It recognizes unique regions by a combination of their vm.pst_space and vm.pst_vaddr.

It divides the credited size of a region by the reference count. If three processes share a memory segment then they each get billed for one third of its size. You can run the program with either user ids or user names to look for.

The ps command is really naive about process size. It reports only the total size of text, data, and stack. It completely misses mmap, shared memory and shared libraries.
Sundar_7
Honored Contributor

Re: HP-UX process VM size: discriminate private and shared memory...

Hi Konc,

Your best bet would be the attached procsize.sh script which extracts itself to an executable procsize util.

With just ps, the resident set size includes the sharedmemory and libs. Once u extract procsize to ur system, run

# procsize -Rvn

This will count the shared memory only once for all the processes that are using the shmem.

Thanks,

Sundar.
Learn What to do ,How to do and more importantly When to do ?