Dynamic Stack Management in Multi-tasking Multi-threaded Operating Systems
Original Publication Date: 1991-Sep-01
Included in the Prior Art Database: 2005-Apr-03
This article describes the architecture for operating system (OS)- provided dynamic stack management that allows stack pages to be allocated and committed on demand by the system.
Dynamic Stack Management in Multi-tasking Multi-threaded
describes the architecture for operating
system (OS)- provided dynamic stack management that allows stack
pages to be allocated and committed on demand by the system.
multi-threaded OS process, each thread has a distinct
register set and stack. The stack for a thread in a 16-bit OS
segmented model can be no larger than 64K, and any reallocation or
stack growth must be explicitly managed by the creator of the thread.
The thread stack is allocated by the creator of the thread, and
passed to the DosCreateThread application programming interface
enabled, a 32-bit OS enables the system to provide
thread stacks larger than 64K. If the stack management is done the
same way as in a 16-bit OS, the system would have to commit enough
swap file storage to guarantee that all pages are available when the
stack for the thread is allocated. This behavior is not desirable
and wastes system swap resource. A mechanism is required that allows
the pages (and swap storage) needed by the thread stack to be
allocated on demand as the thread executes.
to this problem is to provide "sparse" stack
support in the OS. When a thread is created in the 32-bit OS, the
creator of the thread specifies the size of virtual memory to be
reserved for the thread stack. The OS allocates virtual memory for
the thread stack, and commits the first page of the stack as a valid
read/write page. The next stack page is set to the attribute called
"guard." When accessed, guard page attributes are set to their
original attributes when committed (read/write in the case of