Subject: Re: Is the netBSD kernel Preemptible ?
To: None <tech-perform@netbsd.org>
From: Lars Heidieker <lars@heidieker.de>
List: tech-perform
Date: 06/14/2002 20:38:32
Gary Thorpe wrote:

> So basically the kernel can only do cooperative multitasking once kernel
> code is being executed?
>

True

>
> As for waiting on SMP support to change this, I don't think the two are
> necessarily bound together. Sure, SMP will really not perform very well
> until the kernel is premptible/reentrant, but it can be done whether or not
> the machine has more than 1 cpu. E.g. BEOS and QNX both seem to be
> premptible even without SMP. The premptibility allows more things to occur
> concurrently and *can* lead  to better performance even on single cpu
> systems from what I have read (of course there is associated overhead).
>

Kernel Preemption and SMP are not related You can have 1cpu kernels that
premptive
as well as SMP kernels that are not preemptive Mach3/4
With kernel preemtion its easier to get low latency by the cost of few extra
context-switches.

>
> I recently asked a related question on tech-kern (or tech-smp?) about
> whether or not it was necessary to write device driver code with
> locks/synchronization stuff. Since there is a huge amount of code which will
> need to be changed to add reentrancy/premption (sprinkled everywhere in a
> monolithic kernel), I do not think developers should wait for SMP to arrive,
> because then the necessary framework to have it working well will be playing
> catch-up and NetBSD will go through the same thing FreeBSD and Linux are
> still going through.
>

Kernel preemption should make device drivers a bit more complicated,
kernel preemption and smp are related as you have to deal with
thread-concurrency in the code but there is a slight difference with kernel
preemption
you have to deal with thread starvation (-> priority inversion) etc. while
"just" SMP
does not suffer from this.

Lars

>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--
Mystische Erklärungen.
Die mystischen Erklärungen gelten für tief;
die Wahrheit ist, daß sie noch nicht einmal oberflächlich sind.
                --Friedrich Nietzsche