Browse Prior Art Database

Dynamic Stack Management in Multi-tasking Multi-threaded Operating Systems

IP.com Disclosure Number: IPCOM000121706D
Original Publication Date: 1991-Sep-01
Included in the Prior Art Database: 2005-Apr-03
Document File: 2 page(s) / 78K

Publishing Venue

IBM

Related People

Kogan, MS: AUTHOR

Abstract

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.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Dynamic Stack Management in Multi-tasking Multi-threaded Operating
Systems

      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.

      In a 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
(API).

      With paging 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.

      The solution 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
stacks...