Subject: Re: Is the netBSD kernel Preemptible ?
To: None <tech-perform@netbsd.org>
From: Gary Thorpe <gat7634@hotmail.com>
List: tech-perform
Date: 06/14/2002 13:42:55
>From: Lars Heidieker <lars@heidieker.de>
>To: Gary Thorpe <gat7634@hotmail.com>
>CC: tech-perform@netbsd.org
>Subject: Re: Is the netBSD kernel Preemptible ?
>Date: Fri, 14 Jun 2002 19:23:14 +0200
>
[...]
>
>Yes other threads/tasks can enter the kernel while "others" sleep because 
>of
>calling tsleep.
>But (in kernel) a thread/task has to give up its timeslice on its own 
>decision
>(calling tsleep),
>its not forced of the cpu, that happens if the thread leaves the kernel 
>again.
>
>Lars

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

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).

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.

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