2 ms·
> The original code is interrupt driven, and partially co-operatively multitasked. The game spends about a third of the time running the main thread, which gets
by kazinator 5y ago
> The original code is interrupt driven, and partially co-operatively multitasked. The game spends about a third of the time running the main thread, which gets pre-empted by the midscreen and vblank interrupts. The other two thirds of the time is split between those interrupt contexts, which are not pre-empted, but decide when to return to main.
That's just how interrupts work; it is not cooperative multitasking. Taking an interrupt which just returns (no scheduler) is not usually called preemption.
- unwind 5y agoAgreed. Especially since usually the entire point of an interrupt triggered by some hardware-related event (vsync, hsync etc) is that the main thread is not yielding or doing anything at all to cooperate.