SUMMARY: ps command checking memory usage

From: Meg Wall <meg991_at_yahoo.com>
Date: Thu Jun 13 2002 - 10:41:19 EDT
Hi!

Thanks for the following people for their good
information and suggestions, it helps a lot for me to
understand how the Solaris memory system works. 

Homan, Charles (NE)

I believe the memory percent given by "/usr/ucb/ps"
includes shared
libraries.  By adding that column you may be counting
each shared library
multiple times even though it only resides in memory
once.  Check out the
"MemTool" application
(ftp://playground.sun.com/pub/memtool).  Also, look
for the Sun White Paper "The Solaris Memory System"
which provides a good
description of how the Solaris memory system works, as
well as an easy to
follow description of how to use MemTool to determine
how much private vs.
shared memory a process is using.


Will Parsons

This is probably to do with one of your apps using
"Shared memory". I
know Oracle does this, and expect other DBMS's do as
well.
The basic plan is the first process to fire up (the
DBMS engine itself
in the case of Oracle) allocates a load of memory for
code & data
buffering. Any subsequent processes attaching to the
database start a
new UNIX process, then does a "shm_at" call to attach
to the shared
memory of the "master" process. This means that ANY
process attached to
the database will show up with the same amount of
memory as the master
process, but only the master process ACTUALLY
allocates any.


Dave Mitchell

becuase some processes may be sharing the same memory
- eg oracle,
apps that mmap the frame buffer etc etc.


Darren Dunham

It's likely due to shared memory.  It's possible for 5
processes to each
use 100M, but their sum to only be say 150M.  This
would happen if they
each had a large library open, but were all sharing
it.
Using pmap -x on a process, you can see the shared
libraries in use.


Dave Leach

Firstly /usr/bin/ps and /usr/ucb/ps are all the same
in that they are
wrappers to call the platform specific ps (see
/usr/bin/sparcv9/ps for
example).  if you truss these, you'll see that they do
an execve of
/usr/bin/sparcv9/ps for example.
On your question of %mem (pmem) totalling over 100%...
how are you
calculating the size?  what does
/usr/bin/ps -eao "pmem" | awk '{a+=$1} END {print a}'
return?


j.campbell

Does the machine have more than 1 CPU?  If so, it's
cumulative between the 
processors.


John Eisenschmidt

/usr/ucb/ps should be the BSD ps
/usr/sbin/ps should be the SVR4 ps
as for percentage, my guess is physical + swap > 100%.
Did you check this? top is a little better for things
like this, you can d/l it from
http://www.sunfreeware.com


John England

Are any of your processes sharing memory?


Sean Ryan

This is probably because it is counting swap memory in
usage ( which
explains why the machine is heavily loaded =).  Use
vmstat and iostat 
to check your swap usage.
 ****************************
My original question:

> Hi Managers,
> 
> This is strange, I couldn't figure out. I did
> 
> #/usr/ucb/ps -auxww
>  USER  PID %CPU %MEM SZ  RSS TT  S START TIME
> COMMAND
> ...
>  When I added up %MEM column, it's 156.66! Is this
> suppose to be less than 100 since it's showing the
> percentage? I tried /usr/sbin/ps, it's the same,
> these
> two ps are probably the hard links cause they have
> the
> same inode number. 
> 
> This is a heavily loaded 2.6 box. Anybody has a good
> explanation for this? Thanks and I'll summerize.
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu Jun 13 10:46:52 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:46 EST