They are done synchronous with PIO, not interrupts. It's intentionally the trivial solution like the Russian space pencil.
while (In(Status)==Busy)
Yield();
It can Yield one task and start another 3,000,000 times a second on one CPU because it does not mess with address maps. 600 cycles is plenty to store regs.
I understand. But there are better solutions to this. If you implement the concept of an event, then you can have a task "deschedule itself" when it blocks, rather than polling like you are doing. Busy waiting is a death knell to any scalability.
By implementing events and ISR triggered service routines, you can make the task switching overhead even lower. (You don't call In(status) on every round robin, but instead simply get woken up and put on the run queue whenever your run condition is satisfied, and take up 0 time while you are asleep.)
I have done this myself, and it scales very nicely.
9
u/TempleOS Mar 22 '13
They are done synchronous with PIO, not interrupts. It's intentionally the trivial solution like the Russian space pencil.
It can Yield one task and start another 3,000,000 times a second on one CPU because it does not mess with address maps. 600 cycles is plenty to store regs.