[COFF] Terminology query - 'system process'?

Larry McVoy lm at mcvoy.com
Fri Dec 15 09:54:43 AEST 2023


On Thu, Dec 14, 2023 at 06:29:35PM -0500, Noel Chiappa wrote:
>     > From: Bakul Shah
> 
>     > Now I'd probably call them kernel threads as they don't have a separate
>     > address space.
> 
> Makes sense. One query about stacks, and blocking, there. Do kernel threads,
> in general, have per-thread stacks; so that they can block (and later resume
> exactly where they were when they blocked)?

Yep, threads have stacks, not sure how they could work without them.
Which reminds me of some Solaris insanity.  Back when I was at Sun, they
were threading the VM and I/O system.  The kernel was pretty bloated
and a stack was 2 8K pages.  The I/O people wanted to allocate a kernel
thread *per page* that was being sent to disk/network.  I pointed out
that this means if all of memory wants to head to disk, your dirty page
cache is 1/3 of memory because the other 2/3s were thread stacks.  They
ignored me, implemented it, and it was a miserable failure and they had
to start over.  They just didn't believe in basic math.

> Use of a kernel process probably makes the BSD pageout daemon code fairly
> straightforward, too (well, as straightforward as anything done by Berzerkly
> was :-).

I have immense respect for the BSD pageout daemon code.  When I did UFS
clustering to make I/O go at the platter speed (rather than 1/2 the platter
speed), it caused a big problem because the pageout daemon could not keep
up with UFS, UFS used up page cache much faster than the pageout daemon 
could free pages.

I wrote somewhere around 13 different pageout daemons in an attempt to do
better than the BSD one.  And, in certain cases, I did do better.  All of
them did at least a little better.  But none of them did better in all
cases.  

That BSD code was subtly awesome, I was at the top of my game and couldn't
beat it.  I ended up implementing a "free behind" in UFS, I'd watch the
variable that controlled kicking the pageout code into running, and I'd
start freeing behind when it was getting close to running (but enough 
ahead that the pageout daemon wouldn't wake up).  It's a really gross
hack but it was the best that I could come up with.

--lm


More information about the COFF mailing list