Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] FreeBSD PREEMPTION (was: empty rows (PostgreSQL))

On Mon, 14 Feb 2005 11:12:46 -0500, Scott Robbins <> wrote:

> Anyone put the SCHED_ULE and PREEMPTION in a FreeBSD 5.3-STABLE kernel
> on a box with a heavy load?  I've put it in, seen no noticeable
> difference, but I don't have anything really doing much with it.

Well, I would expect that the PREEMPTION option turns on kernel thread
preemption (please correct me if I am wrong here, wileyc), so it would
be expected to make things better for only a specific case of heavy
loads: where the load is caused by a lot of competing processes making
lengthy kernel calls.

I am going quite far out on a limb here, since I have no bloody idea
what the BSD kernel looks like, but if it is anything like Linux
(which I rather suspect that it is, at least in a zoomed-out
architectural view), this is how things work:

1. A userland process, such a Apache, calls, for example, open(2)
2. The C library actually makes the system call
3. Now we are in kernel space for the duration of the call
4. The kernel processes the system call
5. Now we return to userland
6. The userland process executes its next instruction

In a non-preemptible kernel, a context switch to another process can only occur:

- Before or after step (1)
- Before step (2)
- After step (5)
- Before or after step (6)

In a preemptible kernel, a contect switch can occur after any
instruction, even in kernel mode! The goal of this is to make
interactive stuff more responsive even when the kernel is also
servicing lots of other processes.

Have I got it nearly right?


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links