24.05.2014 Views

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sharing the VPs. When the mutex lock is freed, the user scheduler examines the<br />

list of threads waiting for the mutex and activates one of them.<br />

<strong>4.3</strong>.5 Tuning<br />

The M:N pthreads implementation provides several environment variables that<br />

can be used to affect application performance. If possible, the application<br />

developer should provide a front end shell script to invoke the binary executables<br />

in which the user may specify new values to override the system defaults. The<br />

following environment variables can be set by end users and are examined at<br />

process initialization time.<br />

<strong>AIX</strong>THREAD_SCOPE<br />

This variable can be used to set the contention scope of pthreads<br />

created using the default pthread attribute object. It is represented by<br />

the following syntax:<br />

<strong>AIX</strong>THREAD_SCOPE=[P|S]<br />

The value P indicates process scope, while a value of S indicates<br />

system scope. If no value is specified, then the default pthread attribute<br />

object will use process scope contention.<br />

<strong>AIX</strong>THREAD_MNRATIO<br />

This variable allows the user to specify the ratio of pthreads to kernel<br />

threads. It is examined when creating a pthread to determine if a kernel<br />

thread should also be created to maintain the correct ratio. It is<br />

represented with the following syntax:<br />

<strong>AIX</strong>THREAD_MNRATIO=p:k<br />

where k is the number of kernel threads to use to handle p pthreads.<br />

Any positive integer value may be specified for p and k. These values<br />

are used in a formula that employs integer arithmetic, which can result<br />

in the loss of some precision when big numbers are specified. If k is<br />

greater than p, then the ratio is treated as 1:1. If no value is specified,<br />

the default ratio depends on the default contention scope. If system<br />

scope contention is the default, the ratio is 1:1. If process scope<br />

contention is set as the default, the ratio is 8:1.<br />

<strong>AIX</strong>THREAD_SLPRATIO<br />

This variable is used to determine the number of kernel threads used to<br />

support local pthreads sleeping in the library code on a pthread event.<br />

For example, attempting to obtain a mutex. It is represented by the<br />

following syntax:<br />

<strong>AIX</strong>THREAD_SLPRATIO=k:p<br />

where k is the number of kernel threads to reserve for every p sleeping<br />

pthreads. Notice that the relative positions of the numbers indicating<br />

kernel threads and user pthreads are reversed when compared with<br />

<strong>AIX</strong>THREAD_MNRATIO. Any positive integer value may be specified<br />

for p and k. These values are used in a formula that employs integer<br />

arithmetic, which can result in the loss of some precision when large<br />

numbers are specified. If k is greater than p, then the ratio is treated as<br />

1:1. If the variable is not set, then a ratio of 1:12 is used.<br />

The reason for maintaining kernel threads for sleeping pthreads is that,<br />

when the pthread event occurs, the pthread will immediately require a<br />

kernel thread to run on. It is more efficient to use a kernel thread that is<br />

74 <strong>AIX</strong> <strong>Version</strong> <strong>4.3</strong> <strong>Differences</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!