Re: How does pistachio deal with the priority inversion?

Raphael Neider <[email protected]> Wed, 15 Oct 2008 13:32:04 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
> > IPC won't start at all as B will never run.
> So thread A will Blocked for a very long time untill B gets to run?

Yes. However, you can use timeouts in A's IPC operation to avoid/recover
from such situations.

> > L4 leaves this problem to the OS on top, it does not deal with
> > starvation/priority inversion at all. Scheduling on L4 is still not
> > solved satisfactorily.
>  
> NOw, I am messed by L4's schedule mechanism. It' based on static priority and
> timeslice.  When a very high priority thread being wakeup. It will be
> scheduled untill a time interrupt happen?

How can a high priority thread wake up?
  1. receive IPC
  2. timeout, detected at some timer interrupt

In the first case, either a user thread or an interrupt thread explicitly
calls the high priority thread, immediately scheduling it for execution.

In the second case, I assume, the scheduler is invoked after having detected
that a (high priority) thread has reached a timeout.
But even if I am wrong and we do not immediately schedule the timed-out thread,
it will be scheduled after the end of the current timeslice (given no thread
with a still higher priority becomes ready in the meantime).

I am not sure about the 'until' in your question: The woken thread will
be dispatched no later than on the next timer interrupt (see above case 2).
It might be run earlier (case 1 above), but then it can run for a complete
timeslice (which is typically much longer than the timer period).

> And does Pistachio support kernel preempt like the linux kernel 2.6?

The L4 kernel is not preemptible (interrupts are disabled while inside
the kernel) except during string IPC and possibly during the recursive
unmap operation: Here we explicitly enable interrupts to reduce IRQ handler
latency.
All other code paths through the kernel are rather short, so that making
the kernel preemptible would not pay.

Hope that helped,
Raphael