On 10/10/2011 01:37 PM, Nick Copeland wrote:
>> Would
(a) a SCHED_RR/50 thread be run ahead of a SCHED_FIFO/49 thread?
We have three answers, yes, no, and maybe. According to the kernel
scheduler the
answer is yes. The kernel does not actually have the final say here
though which is
why the answers no and maybe can be equally valid. Depending on the code
involved
the SCHED_RR/50 thread might be using semaphores which can cause priority
inversion depending on who owns the semaphore.
The RR/50 can request a semaphore being held my a FIFO/48 and it will
pend. The
FIFO/49 can now pre-empt the FIFO/48 and hence also pre-empt the RR/50. This
may not be what was anticipated. It is bad programming but unusually
easy to do,
especially with regards to audio thread, midi threads, GUI threads and
all the
other gory details of audio app programming.
I only bring it up since I read the original post to concern pre-emption
of high pri
threads and there are ways this can happen depending on what you are doing.
Other people on the list can probably give you better explanation of the
issue and
perhaps even explain whether it is even relevant?
I have ruled out blocking with sync'ing primitives. That isn't happening
when I get these unusual latencies. So for my particular case the answer
is "yes". Cool.
Thanks for the reply,
Michael Ost