Single stack kernel
AssigneeWind River Systems, Inc.
InventorsRobert Gregory Pizzi, Brian Nash
Life of this patent
Estimating the term…
Abstract
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.
Claims34
A system to allocate memory to tasks executed by a device, comprising:
- a memory of the device defining a stack;
- a stack head pointer to indicate locations in the memory;
- and
- an operating system configured to:
- determine a size of the stack used by the tasks;
- assign portions of the stack to individual tasks;
- organize data elements corresponding to register contents of the device in the portions of the stack;
- set the stack head pointer to specify a top position in the stack of an executing task;
- save the register contents used by an executing task in the stack;
- and
- modify the stack head pointer when a context switch of the tasks occurs.
A method to allocate memory to tasks executing on a device, comprising:
- determining a size of a memory stack used by the tasks;
- defining portions of the stack adapted to store register contents of the tasks;
- assigning the portions of the stack to individual tasks;
- organizing data elements in the portions of the stack assigned to the individual tasks to optimize access time to the data elements;
- defining a stack head pointer to specify a top position in the stack of an executing task;
- and
- modifying the stack head pointer when a context switch occurs.
A method comprising:
- determining a first maximum size for memory used by a first task;
- assigning to the first task a first portion of a stack, the first portion of the stack having a size equal to the first maximum size;
- determining a first set of registers to be saved for the first task;
- setting a stack head pointer variable to specify a top position of the first portion of the stack;
- executing the first task;
- determining a second maximum size for memory used by a second task;
- assigning to the second task a second portion of the stack, the second portion of the stack having a size equal to the second maximum size;
- performing a first context switch to execute the second task, including:
- saving contents of the first set of registers in the first portion of the stack;
- saving contents of the stack head pointer variable in the first portion of the stack;
- defining a first chain variable in the first portion of the stack, the first chain variable initially set to a null value;
- and
- setting the stack head pointer variable to specify a top position of the second portion of the stack;
- and
- executing the second task.
Dependencies are inferred from the claim text.