why is pre-emption by lower-priority threads inhibited (and not configurable afaik)
What would be the point of task priorities if this were allowed to occur?
There are cases where this is done, and for good reasons, namely:
priority inheritance for mutexes to avoid priority inversion.
This is when a high priority task is waiting on a mutex held by a low priority task - which has no chance to run as there are other higher priority tasks able to run.
The mutex holding low prio task will be raised to the priority of the waiting task, interrupting the formerly-higher-but-now-lower prio tasks that were holding it from running.
(hope it's clear...)
I use the base priority (zero) for all threads, and always yield to RTOS with osDelay(1) when hanging around. It all works great.
This is a bit funny.
Priorities are a very effective way to make sure tasks run when they are supposed to.
Having them all the same might work in some cases, here, though, you have to resort to explicit yielding: IMHO this means a more rational distribution of priorities might help.
What I find even more strange is the use of a delay: if you mean yield, use yield:
taskYELD(), why introduce a delay - unless this is the only chance some other tasks have to run, further corroborating my suspicion above.
Till now, I have only used preemption without slicing, and some priorities.
As an example, I have this project where a task takes care of receiving, processing and sending out buffers on a I2S interface, others handle user input (buttons and encoder scanning) and output (update a display) plus stuff that takes long to run and has lower priority (creating and displaying an FFT, showing some statistics).
The priorities are in the order above: I want to make sure that as soon as the DMA finishes filling an input buffer, this is read, processed and sent out. User input and output can be processed in the time left so it has a lower priority. The FFT and stat display runs if we are neither handling user input/output or processing the input signal.
No yields, very few delays used in the various loop code.