There are all sorts of preemptive kernels, RTOS's, frameworks, out there, open source and commercial. There are priority-driven preemptive systems, time-sliced preemptive systems, and others.
But preemptive systems have their costs, namely context switching time, and context storing RAM. Even cooperative coroutines have context switch and space overhead.
On the other end of the scale is pure cooperative multitasking, as exemplified by the classic "super loop":
while (1) { task1(); task2(); /* ... */ task99(); task100(); }
In most cases, each of these task calls some lower level routine (timer, communication interface, whatever) to see if there's actually any work for it to do. If not, is just returns. The advantage, of course, is that there is no context overhead, either space or time.
This can be detrimental to response time if an event comes in for a task just after it has had its turn in the super loop. It won't see its event until after every other task has been called, whether the other tasks really have any useful work to do or not.
What I need, and I am planning to develop, is a cooperative task scheduler to replace the super loop. Inter task communication, and ISR to task communication, will go through a kernel to set event flags, timer flags, put messages in queues, etc., and the kernel will track which tasks are actually ready because they have pending events.
After any task returns, the scheduler will execute the highest priority ready task.
My question is, does anyone know of any kernel, RTOS, whatever, that's implemented this way? I'd look at the documentation and API details for any that exist, not their source code.
Knowing whether or not this wheel has already been invented will be handy when I reinvent it.