Patent ID: 7225443
Filing Date: 2007-05-29
Classification: G06F

Abstract:
1. A method of reducing memory and processor usage in a computer operating system utilizing a processor, a memory, and a single stack, comprising: providing a processor, a memory, and a single stack; dividing a plurality of tasks into predetermined priority categories including preemptive tasks and at least one cooperative task that yields control of the processor to tasks of lower priority than itself; associating a stack pointer with each task; setting the stack pointer of the at least one cooperative task to a precalculated worst-case value guaranteed to leave sufficient space in the stack beneath the stack pointer for any preemptive task of lower priority; allocating an area of memory separate from the single stack for the at least one cooperative task to which its stack contents are saved, wherein a size of the area of memory is determined by a declared precalculated worst-case stack usage of the at least one cooperative task at any point at which the at least one cooperative task may yield control of the processor; detecting a need for the at least one cooperative task to yield control of the processor; causing the at least one cooperative task to yield control of the processor to a preemptive task having a lower priority than itself; and causing the current stack pointer and stack space between the task's known base stack pointer and the current stack pointer value to be saved into the area of memory.