Subject: Re: newb: top(1)'s RES column
To: None <netbsd-users@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-users
Date: 07/02/2004 20:52:39
On Thu, Jul 01, 2004 at 10:47:08PM +0200, Peter Bex wrote:
> Good day to all,
> 
> Hate to bother the list with such a newbie question, but searching
> the 'net on this turned up nothing.
> 
> In my `top' list, I see (among others) this:
>   PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
>     9 root      10    0     0K   61M apmev      5:20  0.00%  0.00% [apm0]
> 
> (the exact same SIZE/RES values for all other system processes)
> 
> My question is this: What, exactly, does the RES column display?  The
> manpages are babbling about resident memory, but that doesn't really
> mean anything to me.
> 
> If I understood some of the descriptions on the 'net, RES is the memory
> the process is actually using, and SIZE the memory reserved for the
> process.  This sounds odd, since the usage is more than the reserved memory?

SIZE is the size of the process (including parts that are swapped out), and
RES is the pages of the process loaded in RAM.
I don't know why sometimes, RES is larger than SIZE for regular processes.
kernel threads are special in this area, see below

> 
> Why are all system processes the same size?  Why 61 Mb?  That sounds
> like a lot, and IIRC NetBSD runs on small systems with as little as 16 Mb
> of RAM.

for kernel threads, RES is the size of the kernel itself.
This probably also include pages mapped for the buffer cache, network buffers,
etc ... which explain the large size. Some of these buffers size adapts to
the available memory.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--