Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2000 16:48:24 -0400 (EDT)
From:      Christopher Stein <stein@eecs.harvard.edu>
To:        freebsd-arch@freebsd.org
Subject:   seeking information on kernel threads
Message-ID:  <Pine.OSF.4.20.0008281606280.24840-100000@wally>

next in thread | raw e-mail | index | archive | help

Hello,

I am experimenting with ufs and need to know more about the
general freebsd kernel threads in order to decide where to put some
functionality.

I am hoping that someone will set me straight on the different kernel
threads and what they do. I have managed to glean some information from
the source.

There are 5 threads:

(1) bufdaemon (pid 4): Flushes dirty buffers. The comment in the source
says (kern/vfs_bio.c):

"buffer flushing daemon.  Buffers are normally flushed by the
update daemon but if it cannot keep up this process starts to
take the load in an attempt to prevent getnewbuf() from blocking."

"Update daemon", what's that? Is this a reference to the syncer thread?
Who forks the bufdaemon?

The "update" man page says:

-- cut here --

UPDATE(4)              FreeBSD Kernel Interfaces Manual
UPDATE(4)

NAME
     update - flush internal filesystem caches to disk periodically

SYNOPSIS
     update

DESCRIPTION
     The update kernel process helps protect the integrity of disk volumes
by flushing volatile cached filesystem data to disk.  This is done at
thirty second intervals by default.  The time period may be changed by
using sysctl(8) to modify the kern.update variable.  The update process
does the equivalent of the sync(2) function call to do the task.

-- cut here --

Is this out of date? I thought FreeBSD implemented a trickle sync
algorithm, which would contradict much of the description above.

(2) Syncer (pid 5): sched_sync() in kern/vfs_subr.c. Pretty clear that
this one writes dirty buffers. However, it seems to have a variable 
throttle (speedup_syncer()).. why then the bufdaemon process? Also the pid
number suggests that it is started *after* the bufdaemon. Hmm.

FreeBSD has a unified buffer cache (UBC). How do the file system
cleaning daemons and the paging daemons interact?

(4) pagedaemon (pid 2): writes and evicts VM pages to the swap device via
LRU (??) More info please.

(5) swapper (pid 0): Haven't been able to glean much on this one from the
source. At some points it seems to be a sort of a template for bcopying
into new kernel threads. Its name would suggest that it moves entire
processes out of core and onto the swap device. ?? More info please.

Anyways, information and clarifications are greatly appreciated.

-Chris



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.4.20.0008281606280.24840-100000>