Thread support tunable parameters
There are many thread support parameters that can be tuned.
- ACT_TIMEOUT
Refer to: Thread environment variables.
Item Descriptor Purpose: Tunes the seconds for activation timeouts. Values: Default: DEF_ACTOUT. Range: A positive integer. Display: echo $ACT_TIMEOUT This value is turned on internally, so the initial default value is not seen with the echo command.
Change: ACT_TIMEOUT=n export ACT_TIMEOUT Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding ACT_TIMEOUT=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - AIXTHREAD_COND_DEBUG
Refer to Thread debug options.
Item Descriptor Purpose: Maintains a list of condition variables for use by the debugger. Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_COND_DEBUG This value is turned on internally, so the initial default value is not seen with the echo command.
Change: AIXTHREAD_COND_DEBUG={ON|OFF}
export AIXTHREAD_COND_DEBUGChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_COND_DEBUG={ON|OFF} command to the /etc/environment file.
Diagnosis: Leaving this variable set to ON makes debugging threaded applications easier, but might impose some overhead. Tuning: If the program contains large number of active condition variables and frequently creates and destroys condition variables, this might create higher overhead for maintaining the list of condition variables. Setting the variable to OFF disables the list. - AIXTHREAD_DISCLAIM_GUARDPAGES
Item Descriptor Purpose: Controls whether the stack guardpages are disclaimed. Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_DISCLAIM_GUARDPAGES This value is turned on internally, so the initial default value is not seen with the echo command.
Change: AIXTHREAD_DISCLAIM_GUARDPAGES={ON|OFF};
export AIXTHREAD_DISCLAIM_GUARDPAGESChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_GUARDPAGES=n command to the /etc/environment file.
Diagnosis: NA Tuning: If guardpages are used for pthread stacks, setting AIXTHREAD_DISCLAIM_GUARDPAGES = ON causes the guardpages to be disclaimed when pthreads are created. This parameter can reduce the memory footprint of a threaded application.
Refer to Thread environment variables. - AIXTHREAD_ENRUSG
Refer to Thread environment variables.
Item Descriptor Purpose: Enable or disable pthread resource collection. Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_ENRUSG This value is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_ENRUSG={ON|OFF}
export AIXTHREAD_ENRUSGChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_ENRUSG={ON|OFF} command to the /etc/environment file.
Diagnosis: Setting this parameter to ON allows for resource collection of all pthreads in a process, but will impose some overhead. Tuning: N/A - AIXTHREAD_GUARDPAGES
Refer to Thread environment variables.
Item Descriptor Purpose: Controls the number of guardpages to add to the end of the pthread stack. Values: Default: 1 (where 1 is a decimal value for the number of pages, which can be 4K, 64K and so on.) Range: A range of n. Display: echo $AIXTHREAD_GUARDPAGES This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_GUARDPAGES=n
export AIXTHREAD_GUARDPAGESChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_GUARDPAGES=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - AIXTHREAD_MINKTHREADS
Refer to: Variables for process-wide contention scope.
Item Descriptor Purpose: Controls the minimum number of kernel threads that should be used. Values: Default: 8. Range: A positive integer value. Display: echo $AIXTHREAD_MINKTHREADS This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_MINKTHREADS=nexport AIXTHREAD_MINKTHREADS Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_MINKTHREADS =n command to the /etc/environment file.
Diagnosis: N/A Tuning: The library scheduler will not reclaim kernel threads below the value set in this variable. A kernel thread might be reclaimed at virtually any point. Generally, a kernel thread is targeted as a result of a pthread terminating. - AIXTHREAD_MNRATIO
Refer to: Variables for process-wide contention scope
Item Descriptor Purpose: Controls the scaling factor of the library. This ratio is used when creating and terminating pthreads. Values: Default: 8:1 Range: Two positive values (p:k), where k is the number of kernel threads that should be employed to handle the number of executable pthreads defined in the p variable. Display: echo $AIXTHREAD_MNRATIO This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_MNRATIO=p:kexport AIXTHREAD_MNRATIO Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_MNRATIO=p:k command to the /etc/environment file.
Diagnosis: N/A Tuning: Might be useful for applications with a very large number of threads. However, always test a ratio of 1:1 because it might provide better performance. - AIXTHREAD_MUTEX_DEBUG
Refer to: Thread debug options
Item Descriptor Purpose: Maintains a list of active mutexes for use by the debugger. Values: Default: OFF. Possible values: ON, OFF. Display: echo $AIXTHREAD_MUTEX_DEBUG This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_MUTEX_DEBUG={ON|OFF}export AIXTHREAD_MUTEX_DEBUG This change takes effect immediately and is effective until you log out of this shell. Permanent change is made by adding the AIXTHREAD_MUTEX_DEBUG={ON|OFF} command to the /etc/environment file.
Diagnosis: Setting the variable to ON makes debugging threaded applications easier, but might impose some overhead. Tuning: If the program contains a large number of active mutexes and frequently creates and destroys mutexes, this might create higher overhead for maintaining the list of mutexes. Leaving the variable set to OFF disables the list. - AIXTHREAD_MUTEX_FAST
Refer to: Thread debug options
Item Descriptor Purpose: Enables the use of the optimized mutex locking mechanism. Values: Default: OFF. Possible values: ON, OFF. Display: echo $AIXTHREAD_MUTEX_FAST This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_MUTEX_FAST={ON|OFF}export AIXTHREAD_MUTEX_FAST This change takes effect immediately and is effective until you log out of this shell. Permanent change is made by adding the AIXTHREAD_MUTEX_FAST={ON|OFF} command to the /etc/environment file.
Diagnosis: Setting the variable to ON forces threaded applications to use an optimized mutex locking mechanism, resulting in increased performance. Tuning: If the program experiences performance degradation due to heavy mutex contention, then setting this variable to ON will force the pthread library to use an optimized mutex locking mechanism that works only on process private mutexes. These process private mutexes must be initialized using the pthread_mutex_init routine and must be destroyed using the pthread_mutex_destroy routine. - AIXTHREAD_READ_GUARDPAGES
Refer to Thread environment variables.
Item Descriptor Purpose: Controls the read access to guardpages that are added to the end of the pthread stack. Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_READ_GUARDPAGES This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_READ_GUARDPAGES={ON|OFF}
export AIXTHREAD_GUARDPAGESChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_READ_GUARDPAGES={ON|OFF} command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - AIXTHREAD_RWLOCK_DEBUG
Refer to: Thread debug options
Item Descriptor Purpose: Maintains a list of read-write locks for use by the debugger. Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_RWLOCK_DEBUG This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_RWLOCK_DEBUG={ON|OFF}export AIXTHREAD_RWLOCK_DEBUG Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_RWLOCK_DEBUG={ON|OFF} command to the /etc/environment file.
Diagnosis: Setting this parameter to ON makes debugging threaded applications easier, but might impose some overhead. Tuning: If the program contains a large number of active read-write locks and frequently creates and destroys read-write locks, this might create higher overhead for maintaining the list of read-write locks. Setting the variable to OFF will disable the list. - AIXTHREAD_SUSPENDIBLE
Refer to: Thread debug options
Item Descriptor Purpose: Prevents deadlock in applications that use the following routines with the pthread_suspend_np or pthread_suspend_others_np routines: - pthread_getrusage_np
- pthread_cancel
- pthread_detach
- pthread_join
- pthread_getunique_np
- pthread_join_np
- pthread_setschedparam
- pthread_getschedparam
- pthread_kill
Values: Default: OFF. Range: ON, OFF. Display: echo $AIXTHREAD_SUSPENDIBLE This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_SUSPENDIBLE={ON|OFF}export AIXTHREAD_SUSPENDIBLE Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_SUSPENDIBLE={ON|OFF} command to the /etc/environment file.
Diagnosis: There is a small performance penalty associated with this variable. Tuning: This variable should only be enabled if the aforementioned functions are used with the pthread_suspend_np routine or the pthread_suspend_others_np routine. - AIXTHREAD_SCOPE
Refer to: Thread environment variables
Item Descriptor Purpose: Controls contention scope. A value of P signifies process-based contention scope (M:N). A value of S signifies system-based contention scope (1:1). Values: Default: P. Possible Values: P or S. Display: echo $AIXTHREAD_SCOPE This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_SCOPE={P|S}export AIXTHREAD_SCOPE Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_SCOPE={P|S} command to the /etc/environment file.
Diagnosis: If fewer threads are being dispatched than expected, try system scope. Tuning: Tests show that certain applications can perform better with system-based contention scope (S). The use of this environment variable impacts only those threads created with the default attribute. The default attribute is employed when the attr parameter to pthread_create is NULL. - AIXTHREAD_SLPRATIO
Refer to: Variables for process-wide contention scope
Item Descriptor Purpose: Controls the number of kernel threads that should be held in reserve for sleeping threads. Values: Default: 1:12. Range: Two positive values (k:p), where k is the number of kernel threads that should be held in reserve for p sleeping pthreads. Display: echo $AIXTHREAD_SLPRATIO This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_SLPRATIO=k:pexport AIXTHREAD_SLPRATIO Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_SLPRATIO=k:p command to the /etc/environment file.
Diagnosis: N/A Tuning: In general, fewer kernel threads are required to support sleeping pthreads, because they are generally woken one at a time. This conserves kernel resources. - AIXTHREAD_STK=n
Item Descriptor Purpose: The decimal number of bytes that should be allocated for each pthread. This value can be overridden by the pthread_attr_setstacksize routine. Values: Default: 98 304 bytes for 32-bit applications, 196 608 bytes for 64-bit applications. Range: Decimal integer values from 0 to 268 435 455 which will be rounded up to the nearest page (currently 4 096). Display: echo $AIXTHREAD_STK This is turned on internally, so the initial default value will not be seen with the echo command.
Change: AIXTHREAD_STK=sizeexport AIXTHREAD_STK Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the AIXTHREAD_STK=size command to the /etc/environment file.
Diagnosis: If analysis of a failing program indicates stack overflow, the default stack size can be increased. Tuning: If trying to reach the 32 000 thread limit on a 32-bit application, it might be necessary to decrease the default stack size. - AIXTHREAD_AFFINITY
Refer to: Thread environment variables
Item Descriptor Purpose: Controls the placement of pthread structures, stacks, and thread-local storage on an enhanced affinity enabled system. Values: Default: existing. Range: existing, always, attempt. Display: echo $AIXTHREAD_AFFINITY This is turned on internally, so the initial default value will not be seen with theecho command.
Change: AIXTHREAD_AFFINITY ={default|strict|first-touch} export AIXTHREAD_AFFINITY
Diagnosis: Setting the variable to strict will improve the performance of threads, however, at the cost of additional start-up time.
Setting the variable to default maintains the previous balanced implementation.
Setting the variable to first-touch will balance the start-up performance costs along with the run-time benefits.
Tuning: If threads are expected to be long-running, then setting the variable to strict will improve performance. However, large number of short-running threads should set the variable either to default or first touch. - MALLOCBUCKETS
Refer to: Malloc Buckets
Item Descriptor Purpose: Enables buckets-based extension in the default memory allocator that might enhance performance of applications that issue large numbers of small allocation requests. Values: MALLOCTYPE=buckets MALLOCBUCKETS=[[ number_of_buckets:n | bucket_sizing_factor:n | blocks_per_bucket:n | bucket_statistics:[stdout|stderr|pathname]],...]
The following table displays default values of MALLOCBUCKETS.- MALLOCBUCKETS options
- Default value
- number_of_buckets1
- 16
- bucket_sizing_factor (32-bit)2
- 32
- bucket_sizing_factor (64-bit)3
- 64
- blocks_per_bucket
- 10244
Note:1. The minimum value allowed is 1. The maximum value allowed is 128.
2. For 32-bit implementations, the value specified for bucket_sizing_factor must be a multiple of 8.
3. For 64-bit implementations, the value specified for bucket_sizing_factor must be a multiple of 16.
4. The bucket_statistics option is disabled by default.
Display: echo $MALLOCBUCKETS; echo $MALLOCTYPE Change: Use the shell-specific method of exporting the environment variables. Diagnosis: If malloc performance is slow and many small malloc requests are issued, this feature might enhance performance. Tuning: To enable malloc buckets, the MALLOCTYPE environment variable has to be set to the value "buckets". The MALLOCBUCKETS environment variable can be used to change the default configuration of the malloc buckets, although the default values should be sufficient for most applications.
The number_of_buckets:n option can be used to specify the number of buckets available per heap, where n is the number of buckets. The value specified for n will apply to all available heaps.
The bucket_sizing_factor:n option can be used to specify the bucket sizing factor, where n is the bucket sizing factor in bytes.
The blocks_per_bucket:n option can be used to specify the number of blocks initially contained in each bucket, where n is the number of blocks. This value is applied to all of the buckets. The value of n is also used to determine how many blocks to add when a bucket is automatically enlarged because all of its blocks have been allocated.
The bucket_statistics option will cause the malloc subsystem to output a statistical summary for malloc buckets upon typical termination of each process that calls the malloc subsystem while malloc buckets is enabled. This summary will show buckets configuration information and the number of allocation requests processed for each bucket. If multiple heaps have been enabled by way of malloc multiheap, the number of allocation requests shown for each bucket will be the sum of all allocation requests processed for that bucket for all heaps.
The buckets statistical summary will be written to one of the following output destinations, as specified with the bucket_statistics option.- stdout
- Standard output
- stderr
- Standard error
- pathname
- A user-specified pathname
If a user-specified pathname is provided, statistical output will be appended to the existing contents of the file (if any). Avoid using standard output as the output destination for a process whose output is piped as input into another process.
- MALLOCMULTIHEAP
Refer to: Thread environment variables
Item Descriptor Purpose: Controls the number of heaps within the process private segment. Values: Default: 32. Range: A positive number between 1 and 32. Display: echo $MALLOCMULTIHEAP This is turned on internally, so the initial default value will not be seen with the echo command.
Change: MALLOCMULTIHEAP=[[heaps:n | considersize],...] export MALLOCMULTIHEAP Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the MALLOCMULTIHEAP=[[heaps:n | considersize],...] command to the /etc/environment file.
Diagnosis: Look for lock contention on the malloc lock (located in segment F) or fewer than expected runnable threads. Tuning: Smaller number of heaps can help reduce the size of the process. Certain multithreaded user processes that use the malloc subsystem heavily might obtain better performance by exporting the MALLOCMULTIHEAP=1 environment variable before starting the application. The potential performance enhancement is particularly likely for multithreaded C++ programs, because these may make use of the malloc subsystem whenever a constructor or destructor is called.
Any available performance enhancement will be most evident when the multithreaded user process is running on an SMP system, and particularly when system scope threads are used (M:N ratio of 1:1). However, in some cases, enhancement might also be evident under other conditions, and on uniprocessors.
If the considersize option is specified, an alternate heap selection algorithm is used that tries to select an available heap that has enough free space to handle the request. This might minimize the working set size of the process by reducing the number of sbrk() calls. However, there is a bit more processing time required for this algorithm.
- NUM_RUNQ
Refer to: Thread environment variables
Item Descriptor Purpose: Changes the number of the default number of run queues. Values: Default: Number of active processors found at run time. Range: A positive integer. Display: echo $NUM_RUNQ This is turned on internally, so the initial default value will not be seen with the echo command.
Change: NUM_RUNQ=n export NUM_RUNQ Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the NUM_RUNQ=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - NUM_SPAREVP
Refer to: Thread environment variables
Item Descriptor Purpose: Sets the number of vp structures that will be malloc'd during pth_init
time.Values: Default: NUM_SPARE_VP. Range: A positive integer. Display: echo $NUM_SPAREVP This is turned on internally, so the initial default value will not be seen with the echo command.
Change: NUM_SPAREVP=n export NUM_SPAREVP Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the NUM_SPAREVP=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - SPINLOOPTIME
Refer to: Thread environment variables
Item Descriptor Purpose: Controls the number of times to retry a busy lock before yielding to another processor (only for libpthreads). Values: Default: 1 on uniprocessors, 40 on multiprocessors. Range: A positive integer. Display: echo $SPINLOOPTIME This is turned on internally, so the initial default value will not be seen with the echo command.
Change: SPINLOOPTIME=nexport SPINLOOPTIME Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the SPINLOOPTIME=n command to the /etc/environment file.
Diagnosis: If threads are going to sleep often (lot of idle time), then the SPINLOOPTIME might not be high enough. Tuning: Increasing the value from the default of 40 on multiprocessor systems might be of benefit if there is pthread mutex contention. - STEP_TIME
Refer to: Thread environment variables
Item Descriptor Purpose: Tunes the number of times it takes to create a VP during activation timeouts. Values: Default: DEF_STEPTIME. Range: A positive integer. Display: echo $STEP_TIME This is turned on internally, so the initial default value will not be seen with the echo command.
Change: STEP_TIME=n export STEP_TIME Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the STEP_TIME=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - VP_STEALMAX
Refer to: Thread environment variables
Item Descriptor Purpose: Tunes the number of VPs that can be stolen or turns off VP stealing. Values: Default: None. Range: A positive integer. Display: echo $VP_STEALMAX This is turned on internally, so the initial default value will not be seen with the echo command.
Change: VP_STEALMAX=n export VP_STEALMAX Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the VP_STEALMAX=n command to the /etc/environment file.
Diagnosis: N/A Tuning: N/A - YIELDLOOPTIME
Refer to: Thread environment variables
Item Descriptor Purpose: Controls the number of times to yield the processor before blocking on a busy lock (only for libpthreads). The processor is yielded to another kernel thread, assuming there is another runnable kernel thread with sufficient priority. Values: Default: 0. Range: A positive value. Display: echo $YIELDLOOPTIME This is turned on internally, so the initial default value will not be seen with the echo command.
Change: YIELDLOOPTIME=nexport YIELDLOOPTIME Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding the YIELDLOOPTIME=n command to the /etc/environment file.
Diagnosis: If threads are going to sleep often (lot of idle time), then the YIELDLOOPTIME might not be high enough. Tuning: Increasing the value from the default value of 0 may benefit you if you do not want the threads to go to sleep while they are waiting for locks.