User-Level Native Thread Primitives (GThread) Library White Paper (G06.26+)

User-Level Native Thread Primitives (GThread Library) 03/31/2005
Hewlett-Packard Company--540065-001 Page 9 of 46
For TNS or TNS/R threads, many of the following members relate to the single stack. For TNS/E, which
must deal with two stack components, they are private; equivalent information can be acquired via the
interfaces described in Section 2.9.
STRING .EXT StackOrigin
designates the stack origin for the thread; it is set by the GTHREAD_INITIATE_ procedure and used
by the GTHREAD_SETJMP_ procedure. For static threads, StackOrigin designates the program-
allocated stack area. For swapped threads, it is the "swap origin," the demarcation between the stack
root and the swapped part of the process stack. The GTHREAD_ORIGIN_SET_ procedure sets the
current tip of the Main stack into MainCB.StackOrigin, which GTHREAD_INITIATE_ copies into
the CB of other swapped threads.
INT(32) StackSize
is the stack size allocated for the thread. This field is set by GTHREAD_INITIATE_. It is available
for limit checking.
STRING .EXT SwapArea
specifies the swap area. It is set by GTHREAD_INITIATE_ but not otherwise used by the GThread
primitives; it is available to the NonStop operating system for possible diagnostic use. The field
contains zero for a static thread, the starting address of a contiguous swap area, or an invalid value for
a swapped thread whose swap area is discontiguous. See the SwapArea defines.
STRING .EXT StackStart and INT(32) StackUsed
are the starting (lowest) address and byte length of the in-use mem stack area, set by
GTHREAD_SETJMP_ for use by the program for swapping or checkpointing.
STRUCT GThread_Private (GThread_Private_Template)
is a private structure for GThread (an augmented jump buffer).
2.4. Alignment Considerations
The alignment considerations for stack/swap space vary with the platform and the thread model. Both
the starting address and the length of the area must be divisible by the alignment that applies. The
following table indicates the minimum alignment required based on platform and thread model:
Platform Swapped Static
TNS
2 2
TNS/R native
4 8
TNS/E native
8 16