Re: [PATCH] 2.4.0-prerelease: preemptive kernel.

ludovic fernandez
2001-01-05T00:32:39Z

Nigel Gamble wrote:

> On Thu, 4 Jan 2001, ludovic fernandez wrote:
> > This is not the point I was trying to make .....
> > So far we are talking about real time behaviour. This is a very interesting/exciting
> > thing and we all agree it's a huge task which goes much more behind
> > just having a preemptive kernel.
>
> You're right that it is more than just a preemptible kernel, but I don't
> agree that it's all that huge. But this is the third time I have worked
> on enabling real-time behavior in unix-like OSes, so I may be biased ;-)
>
> > I'm not convinced that a preemptive kernel is interesting for apps using
> > the time sharing scheduling, mainly because it is not deterministic and the
> > price of a mmu conntext switch is still way to heavy (that's my 2 cents belief
> > anyway).
>
> But as Roger pointed out, the number of extra context switches
> introduced by having a preemptible kernel is actually very low. If an
> interrupt occurs while running in user mode, the context switch it may
> cause will happen even in a non-preemptible kernel. I think that
> running a kernel compile for example, the number of context switches per
> second caused by kernel preemption is probably between 1% and 10% of the
> total context switches per second. And it's certainly interesting to me
> that I can listen to MP3s without interruption now, while doing a kernel
> build!
>

I agree Nigel, but as you pointed out you will have to deal with
scheduling behaviour, interrupt latency and priority inversion to
achieve that.
I was just trying to point out that just having kernel preemptable threads
will enable, for example, kswapd to adjust itself more efficiently with the
current load of the system and what it needs to achieve (running from
low priority to non preemptable thread). Providing a better (smoother)
swap behaviour.
Saying that, I definitely agree that I want/need to one day listen to
my MP3s while building my kernel.

Ludo.