Why would my server be swapping...
James Wilkinson
james at westexe.demon.co.uk
Thu Oct 14 17:04:12 UTC 2004
Wouter van Vliet wrote:
> Anyway, you happen to know a command that like really tells me what
> processes are consuming memory? I know top, but no matter how close I
> look I cannot find all of the memory used in it's output.
Um. In general, that's a hard question to answer.
* A lot of the memory a program uses is "memory-mapped" from a file
(often the executable). This means that the same page can represent
the cached filesystem page and the memory used by several programs.
For example, if you have six bash processes open, the "code" part of
the program only needs to appear in memory once.
* Often, a program can demand multiple megabytes of memory, but not use
all that memory immediately. In this case, the OS doesn't actually
assign a memory page until it *is* needed. In the meantime, the
memory can be doing productive work buffering the disk, or being used
by other programs which might finish before the first program needs
the memory. (And very often, a program won't use all the pages it
demands anyway).
* If you have significant amounts of shared memory (i.e. shared between
processes, and this is visible to those processes), then how is top
supposed to represent that?
(There are other factors.)
Top and ps are probably the best command line tools you have. But if you
really want to know what's happening, you have to appreciate what might
be happening.
Hope this helps,
James.
--
E-mail address: james | "But alas, we don't need a car, so I have a bus
@westexe.demon.co.uk | timetable and one day the buses will read it too."
| -- Telsa Gwynne
More information about the fedora-list
mailing list