[ale] KDE System Guard (was Linux desktop inefficiencies...)

Joseph Knapka jknapka at earthlink.net
Sat Apr 26 09:13:27 EDT 2003


CB Genrich <cb at kona-kahuna-nui.com> writes:

> Along these lines,
> 
> I use KDE System Guard.  By default the graph labeled
> "Physical Memory" comes along plotting three values:
>
>   mem/physical/application
>   mem/physical/buf
>   mem/physical/cached
>
> I have observed that buf and cached pretty much need to
> fit in RAM with application, or my system starts to bog
> down (or did before I went to 768M).
>
> What do these things plot?  What do they mean?

Basically, you've got three kinds of memory usage:

1: Cache: this is RAM backed by files on disk, including swap files,
executable files, and mmap()ed data files.  We keep those pages in RAM
for as long as possible, because whan a process yells "Hey, I need
page X and it ain't here!" it's far cheaper to service that fault if
page X is alread in memory, rather than having to read it from
disk. In general, cache pages can be thrown away when new RAM is
needed, so they don't really cost you anything. Cache is a *good*
thing; large amounts of free RAM are *bad* (because hey, they could be
used for cache).

2: Anonymous: this is memory allocated on the fly by applications and not
backed by on disk files. This is the kind of memory you get when you
call malloc() (although these pages are added to the cache if they're
ever swapped out).

3: Other: memory allocated by the kernel for internal use.

Buffers are for pages which are undergoing disk I/O; in recent Linux
kernels, buffer pages are part of the page cache, so they don't really
count as a separate classification.

As you see, it's not really obvious how these categories map onto the
"buf" vs "cache" vs "application" numbers reported by System Guard.
So the meaning of those numbers depends entirely on how the authors of
System Guard chose to do their memory accounting.

If you *really* want to know what's going on with memory usage,
"cat /proc/meminfo" and look at the following lines:

Active: <Kbytes> -- this is the amount of RAM in active use, not
including anonymous pages that have never been swapped out. This is
the stuff that really can't be thrown away by the kernel without
seriously affecting system performance.

Inactive: <Kbytes> -- this is the amount of RAM in the cache that
hasn't been used recently. This is essentially free RAM; whenever
something needs new RAM, the kernel will throw inactive pages away
without mercy.

Now here's the tricky part:

MemTotal - MemFree is the total amount of physical RAM in use. If you
subtract Active + Inactive from that, you get the amount of memory in
use that is *not* part of the cache. This memory will be used in two
ways:

(1) RAM allocated by the kernel for internal use, and

(2) Anonymous RAM allocated by applications which has never been
swapped out (since swapped anonymous pages are added to the cache).

In most cases, the vast majority of this non-cache RAM will be of
variety (2). Thus, (MemTotal-MemFree) - (Active+Inactive) tells you
(approximately) how much RAM is being used by applications for *data*.

HTH,

-- Joe Knapka
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list