A system for allocating memory for execution of computational tasks in an
embedded device is described. The system uses a single stack to store the
runtime memory for an executing task, and the context for selected
suspended tasks, pointers are dynamically set to indicate top of stack
locations for the tasks, and context locations for suspended tasks. The
amount of memory in the stack is optimized during run time to use the
least memory necessary.