摘要 |
While preemptive multitasking has been available for task-driven methods that use multiple call stacks and even-driven methods that use a single call stack, an embodiment of a new method teaches how preemptive multitasking may be achieved in a single call stack for task-driven applications. The new method requires significantly less memory and processing overhead than required to manage multiple call stacks and provides a significant reduction in transition states and lines of application code than required for event-driven methods. The method comprises providing a single call stack, providing a preemptive scheduler, providing a wait operation which is followed by a return to the scheduler, wherein execution context is not preserved, and providing a signal operation which may be invoked synchronously from a task handling function and/or asynchronously from an interrupt routine, whereby the scheduler is invoked and execution context is preserved and subsequently restored by the single call stack. |