Re: Is the netBSD kernel Preemptible ?

[email protected] (Matthias Scheler)
Newsgroups gmane.os.netbsd.devel.smp
Organization Z'Ha'Dum - home of the shadows
Message-ID <[email protected]>
In article <[email protected]>,
	[email protected] (Greg A. Woods) writes:
>> The SVR4 kernel was changed to allow preemption in the kernel
>> at the same time as it was made SMP.
> 
> So, how exactly does an application level process go about the task of
> preempting the kernel?

It simply gets scheduled. In SunOS 5.x which is a SVR with a preemptable
SMP kernel the kernel runs threads. There are kernel only threads (e.g.
the page daemon) and threads with an user process attached to them.
If an user process performs a system call its thread simply enters the
kernel but remains a normal thread which can be preempted. On a Solaris
kernel where the RealTime scheduler class is loaded the priorities
looks somethings like this:

151-160	high level interrupts
101-150	RealTime user threads
 61-100 normal kernel threads
 0 - 60 normal user threads

[I'm not 100% about the absolute numbers but they are not important.]

As a result kernel threads can preempt each other and users threads
can preempt kernel threads if they have a high priority. This requires
fine grained locking of course.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.