z/OS Language Environment Customization
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


STACK

z/OS Language Environment Customization
SA38-0685-00

STACK controls the allocation of the thread's stack storage for both the upward and downward-growing stacks. Typical items residing in the upward-growing stack are C or PL/I automatic variables, COBOL LOCAL-STORAGE data items, and work areas for COBOL library routines.

The downward growing stack is allocated only when an application has been built with XPLINK.

Storage required for the common anchor area (CAA) and other control blocks is allocated separately from, and before, the allocation of the initial stack segment and the initial heap.

Non-CICS default
STACK=((128K,128K,ANYWHERE,KEEP,512K,128K),OVR)
CICS® default
STACK=((4K,4080,ANYWHERE,KEEP,4K,4080),OVR)
Read syntax diagramSkip visual syntax diagram
Syntax

>>-STACK--=--(--(--usinit_size--,--usincr_size--,--------------->

   .-ANYWHERE-.     .-KEEP-.                                   
>--+-ANY------+--,--+-FREE-+--,--dsinit_size--,--dsincr_size---->
   '-BELOW----'                                                

         .-OVR----.      
>--)--,--+-NONOVR-+--)-----------------------------------------><

usinit_size
Determines the size of the initial upward-growing stack segment. The storage is contiguous. You specify the usinit_size value as n, nK, or nM bytes of storage. The actual amount of allocated storage is rounded up to the nearest multiple of 8 bytes.

usinit_size can be preceded by a minus sign. In environments other than CICS, if you specify a negative number Language Environment uses all available storage minus the amount specified for the initial stack segment.

A size of "0" or "-0" requests half of the largest block of contiguous storage in the region below the 16-MB line.

usincr_size
Determines the minimum size of any subsequent increment to the upward-growing stack area. You can specify this value as n, nK, or nM bytes of storage. The actual amount of allocated storage is the larger of two values (usincr_size or the requested size) rounded up to the nearest multiple of 8 bytes

If you specify usincr_size as 0, only the amount of the storage needed at the time of the request, rounded up to the nearest multiple of 8 bytes, is obtained.

The requested size is the amount of storage a routine needs for a stack frame. For example, if the requested size is 9000 bytes, usincr_size is specified as 8K, and the initial stack segment is full, Language Environment gets a 9000 byte stack increment from the operating system to satisfy the request. If the requested size is smaller than 8K, Language Environment gets an 8K stack increment from the operating system.

ANYWHERE | ANY | BELOW
Specifies the storage location. For downward growing stack, this option is ignored and the storage is always placed above 16 MB.
BELOW
Specifies that the stack storage must be allocated below the 16MB line in storage that is accessible to 24-bit addressing.
ANYWHERE | ANY
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 16-MB line.
KEEP | FREE
Determines the disposition of the storage increments when the last stack frame in the increment segment is freed.
KEEP
Specifies that storage allocated to stack increments is not released when the last of the storage in the stack increment is freed.
FREE
Specifies that storage allocated to stack increments is released when the last of the storage in the stack is freed. The initial stack segment is never released until the enclave terminates.
dsinit_size
Determines the size of the initial downward growing stack segment. The storage is contiguous. You specify the dsinit_size value as n, nK, or nM bytes of storage. The actual amount of allocated storage is rounded up to the nearest multiple of 16 bytes.
dsincr_size
Determines the minimum size of any subsequent increment to the downward growing stack area. You can specify this value as n, nK, or nM bytes of storage. The actual amount of allocated storage is the larger of two values-- dsincr_size or the requested size--rounded up to the nearest multiple of 16 bytes.
OVR
Specifies that the option can be overridden.
NONOVR
Specifies that the option cannot be overridden.

CICS considerations

dsinit_size and dsincr_size suboptions are ignored under CICS.

The maximum initial and increment size for CICS above 16 MB is 1 gigabyte (1024 MB). This restriction is subject to change from one release of CICS to another.

Both the initial size and the increment size are rounded up to the nearest multiple of 8 bytes. The initial size minimum is 4 KB.

If you do not specify STACK, Language Environment assumes the default value of 4 KB. Under CICS, STACK(0), STACK (-0), and STACK (-n) are all interpreted as STACK(4K).

The default increment size under CICS is 4080 bytes, rather than 4096 bytes, to accommodate the 16 bytes CICS storage check zone. Without this accommodation, an extra page of storage is allocated (only when the storage allocation is below the 16MB line).

z/OS® UNIX considerations

The STACK option specifies the characteristics of the user stack for the initial thread. In particular, it gets the initial size of the user stack for the initial thread.

The characteristics that indicate incr_size, ANYWHERE, and KEEP | FREE apply to any thread created using pthread_create. Language Environment gets the initial stack size from the thread's attribute object specified in the pthread_create function. The default size to be set in the thread's attribute object is obtained from the STACK run-time option's initial size.

The recommended default setting for STACK under z/OS UNIX is STACK=((12K,12K,ANYWHERE,KEEP,512K,128K),OVR).

Usage notes

When an application is running in an XPLINK environment (that is, either the XPLINK(ON) runtime option was specified, or the initial program contained at least one XPLINK-compiled part), the STACK runtime option will be forced to STACK(,,ANY,,,). Only the third suboption of the STACK runtime option is changed by this action, to indicate that stack storage can be allocated anywhere in storage. No message will be issued to indicate this action. In this case, if a Language Environment runtime options report is generated using the RPTOPTS runtime option, the STACK option will be reported as "Override" under the LAST WHERE SET column.

The dsinit_size and dsincr_size 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 the storage getmained will be 4K (8K if a 4K page alignment cannot be guaranteed) larger to accommodate the guard area.

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.

Applications running with ALL31(OFF) must specify STACK(,,BELOW,,,) to ensure that stack storage is addressable by the application.

PL/I considerations
PL/I automatic storage above the 16-MB line is supported under control of the Language Environment STACK option. When the Language Environment stack is above, PL/I temporaries (dummy arguments) and parameter lists (for reentrant/recursive blocks) also reside above.

The stack frame size for an individual block is constrained to 16MB. Stack frame extensions are also constrained to 16MB. Therefore, the size of an automatic aggregate, temporary variable, or dummy argument cannot exceed 16MB. Violation of this constraint might have unpredictable results.

If an OS PL/I application does not contain any edited stream I/O and if it is running with AMODE 31, you can relink it with Language Environment to use STACK(,,ANY,,,). Doing so is particularly useful under CICS to help relieve below-the-line storage constraints.

PL/I MTF considerations
The STACK option allocates and manages stack storage for the PL/I main task only. For information about stack storage management in the subtasks, see THREADSTACK.

Performance considerations

To improve performance, use the storage report numbers generated by the RPTSTG run-time option as an aid in setting the initial and increment sizes for STACK.

For more information

  • See ALL31, for more information about the ALL31 run-time option.
  • See RPTSTG, for more information about the RPTSTG run-time option.
  • See THREADSTACK, for more information about the THREADSTACK run-time option.
  • For more information about using the storage reports generated by the RPTSTG run-time option to tune the stacks, see z/OS Language Environment Programming Guide.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014