Fri Aug 16 21:22:10 EDT 2013
Tasks vs state machines
I wonder if it is really just about the switching mechanism:
- task: switch stack pointer, registers and other global/CPU state
- state machine: switch current object
i.e. from a system's perspective, the difference is in task switching
speed. If nothing has to be copied, this can be quite fast. However,
the cost is amortized through slower indirect access.
What non-preemptive tasks/state machines (let's consider them
equivalent) have in common is a better handle on where the data
actually is: no time is wasted in "caching" per-thread state.