http://en.wikipedia.org/wiki/Priority_inversionexplained quite well there.
in this case the shooting threads need memory.
this memory is allocated by a manager which has a
lower priority than the shooting threads.
so for the time the shooting threads were executed, the memory manager didnt get time for processing.
this was no problem, as the FIO_Write function waited for a semaphore released by interrupts and thus handed CPU over to other threads.
now i am (well, i was) blocking the shooting threads while they are writing.
blocking with executing real code, not by sleeping or waiting for a semaphore. (sleep also gives away CPU time to the next lower threads)
well, this caused the shooting thread to delay the FIO_Write() call a bit longer, which didnt hurt the task itself.
but i didnt give away cpu time in this call, but i used it to calculate stuff (encrypt).
this lead to the memory manager task, which unfortunately has a lower priority, not being executed fast enough.
some other high priority shooting tasks also didnt give away CPU time and so the memory manager starved.
in the current approach, i just put the encryption into a separate crypt thread, which has a "normal" priority.
so the shooting tasks give away their CPU time by waiting for a semaphore and the memory manager can run.
and all is fine.
funny, eh?