??? 08/07/08 14:38 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#157298 - Multasking can work on the 8051 ... sometimes Responding to: ???'s previous message |
Per said:
So cooperative multitasking is almost as problematic for the 8051 architecture as preemptive multitasking. That leaves the developer with super-loops and creative use of interrupts. Cooperative multitasking is problematic on the 8051 for sure, due to the 8051's limited stack size. But it's not impossible. In fact, the only real problem is the time it takes to copy the stack to and from external memory at every context switch. If this time is small compared with the time between context switches, or if the CPU is idle most of the time anyway (so the overhead doesn't matter), then cooperative multitasking remains a viable option for the 8051. The main benefit of some kind of multitasking is that it lets you write simpler, more modular programs. Each task lives in its own little world, conceptually isolated from all the other tasks. There is less need for "creative" code, and situations like the one originally posed by Marshall are handled very naturally. -- Russ |