Subject: Re: the reaper
To: Jeremy C. Reed <reed@reedmedia.net>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 01/10/2001 13:18:02
On Wed, Jan 10, 2001 at 12:53:46PM -0800, Jeremy C. Reed wrote:

 > Does vmspace and VM resources mean the same thing?

A process's VM resources are contained within a "vmspace" structure,
which in turn contains the vm_map, etc. for the process.

 > What does the following mean?
 >      "Give machine-dependent code a chance to free any resources it
 >      couldn't free while still running on that process's context."

Consider the case of the i386 -- the i386 has a TSS structure per-process,
and the structure must be around while the CPU is running that process's
context.  Therefore, you have to let the CPU switch to another context,
and then free the structure.  The cpu_wait() call where that comment appears
is the hook that does that.

 > What is "u-area" mean? How is it related to the reaper?

U-area is kind of a historic name.  The u-area is the chunk of memory
that contains the "user" struct (which contains the PCB for the process)
as well as the kernel stack for that context.  The reaper, along with the
other things, frees this chunk of memory (since it contains the kernel
stack, it obviously can't be freed while the processor is using it, and
freeing it might require locking VM data structures, which is why the
reaper thread has to do it ... it must be done within a valid context).

 > On a related note, are there any special system processes other than the
 > swapper, pagedaemon, reaper and ioflush?

Well, those are the main ones.  But some device drivers also create their
own kernel threads to do various work.

 > Where is this well documented? (Please note that I have grep'ed the source
 > and manual pages and I do not own "The Design and Implementation of the
 > 4.4BSD Operating System".)

The reaper is a NetBSD thing (well, Solaris also has one).  It's not in
the 4.4BSD book.  It's documented in the source code (the comments).

 > By the way, should I submit my findings to create some manual pages for
 > the Kernel Manual (manual section 9)?

Sure, not a bad idea.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>