THREADSTACK (non-CICS)
THREADSTACK controls the allocation of the thread's
stack storage for both the upward and downward-growing stacks, except for the initial thread in a multi-threaded application.
If a thread attribute object does not provide an explicit stack size, then the allocation values can be inherited from the STACK option or specified explicitly on the THREADSTACK option.
THREADSTACK has the following suboptions :
- ON or OFF :
OFF indicates that the allocation suboptions of the STACK run-time option are used for thread stack allocation. All other suboptions are ignored.
ON controls the stack allocation for each thread, except the initial thread in a multi-threaded environment
- initial size (upward-growing) : the size of the initial upward-growing stack segment, rounded up to the nearest 8 bytes of contiguous storage, maximum size of 512K with ANYWHERE or 128K with BELOW
- initial size units (upward-growing) : the units that initial size is specified in (K)
- increment size (upward-growing) : the minimum size of any subsequent
increment to the upward-growing stack area, rounded up to the nearest 8 bytes, maximum size of 512K with ANYWHERE or 128K with BELOW
- increment size units (upward-growing): the units that increment size is specified in (K)
- initial size (downward-growing) : the size of the initial downward-growing stack segment, rounded up to the nearest 8 bytes of contiguous storage, maximum size of 64 MB
- initial size units (downward-growing) : the units that initial size is specified in (K, M)
- increment size (downward-growing) : the minimum size of any subsequent increment to the downward-growing stack area, rounded up to the nearest 8 bytes, maximum size of 16 MB with ANYWHERE or 64 MB with BELOW
- increment size units (downward-growing) : the units that increment size is specified in (K, M)
- ANYWHERE or BELOW
ANYWHERE specifies that stack storage can be allocated anywhere in storage. If there is no storage available above the line, Language environment acquires storage below the line.
BELOW specifies that the stack storage must be allocated below the 16 MB line in storage that is accessible to 24-bit addressing.
- KEEP or FREE :
FREE specifies that storage allocated to THREADSTACK increments is released when the last of
the storage in the stack is freed. The initial library stack segment is not
released until the enclave terminates.
KEEP specifies that storage allocated to THREADSTACK increments is not released when
the last of the storage in the stack is freed.
Notes :
- The THREADSTACK option replaes the NONIPTSTACK and NONONIPTSTACK options.
- The initial size (downward-growing) and increment size (downward-growing) values are the amounts of storage that can be used for downward-growing stack frames (plus the stack header, approximately 20 bytes). The actual size of storage getmained will be 4K (8K if a 4K page alignment cannot be guaranteed) larger to accomodate the guard page
- The downward-growing stack is only initialized in an
XPLINK supported environment, and only when an XPLINK application is active in the enclave. Otherwise, the suboptions for the downward-growing stack are ignored.
- All storage allocated to THREADSTACK segments are freed when the thread terminates.
- The initial stack segment of the thread is never released until the thread terminates, regardless of the KEEP/FREE state.
- PL/I consideration : For multitasking or multithreaded environments, the stack size for a subtask or non-Initial Process Thread (non-IPT) is taken from the THREADSTACK option unless THREADSTACK(OFF) is specified. THREADSTACK(OFF) specifies that the values in the STACK option be used.
- In a multithreaded environment, you can explicitly specify the stack size in the thread attribute object; it will be used instead of the value specified with THREADSTACK or STACK.