howard chen wrote:
Hello,
I am running Apache HTTPD 1.3.37 with mod_php, when using the top
command, I see:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12584 web 15 0 142m 12m 9176 S 8 0.3 2:07.01 httpd
12586 web 15 0 142m 12m 9168 S 8 0.3 2:08.85 httpd
12589 web 15 0 141m 10m 7376 S 8 0.3 2:06.83 httpd
12591 web 15 0 142m 11m 7420 S 8 0.3 1:59.64 httpd
12594 web 15 0 142m 11m 7444 S 8 0.3 2:06.25 httpd
12585 web 15 0 141m 12m 9200 S 6 0.3 2:03.83 httpd
Assume all the httpd process is show above...
1. Is the total memory currently used is : 12+12+10+11+11+12 = 68M ?
2. Is the max. memory even allocated by is: 142+142+141+142+142+141 = 850M
Thanks.
Welcome to the wonderful world of Linux memory. The memory reported in
the VIRT/RES column cannot simply be added up to calculate the total
memory usage because some memory may be shared. When a process is
fork()'d (to create a child process), the memory between the parent and
child process will be shared. Once a portion of the memory is changed by
the parent or child, that portion of the memory will become distinct
between the two processes. For example:
* Parents using 10MB
* A child process is created
* Child now shows usage of 10MB, although total usage is only 10MB, not
20MB, due to shared memory
* Child process overwrites 5MB of the memory. Now that memory is unique
to the child, so it will be separate
* Memory usage is now 10MB (parent) + 5MB (child) = 15MB (theoretically)
This is just a very basic example, since the true details behind the
memory allocation is more complex. There is a python script available
that will try to give you a more accurate calculation of memory usages
available here:
http://www.pixelbeat.org/scripts/ps_mem.py
--
Justin Pasher
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]