AIXTHREAD_SCOPE

On AIX, the preferred threading model is system-wide rather than process-wide. Add AIXTHREAD_SCOPE=S to you /etc/environment, or your profile to enable it.

The default threading model on AIX is process contention scope. Under process contention scope there is an M:N mapping of user threads to kernel threads. User threads share their kernel thread with other user threads. This may cause threaded applications to “hang” or experience a deadlock.

The recommended threading model to resolve these issues is system contention scope. Under system contention scope there is a 1:1 mapping of user threads to kernel threads. User threads have a dedicated kernel thread that is not used by any other user threads and thread scheduling is handled in the kernel.

The many-to-one or one-to-one thread relationship is set via the AIXTHREAD_SCOPE kernel parameter.

To set the AIXTHREAD_SCOPE kernel parameter:
Add the AIXTHREAD_SCOPE=S command to the /etc/environment file. This affects all applications running on the box.

AIXTHREAD_SCOPE={P|S}

P signifies process-wide contention scope (M:N) and S signifies system-wide contention scope (1:1). Either P or S should be specified and the current default is process-wide scope.

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 the pthread_create() subroutine is NULL.

If a user thread is created with system-wide scope, it is bound to a kernel thread and it is scheduled by the kernel. The underlying kernel thread is not shared with any other user thread.

If a user thread is created with process-wide scope, it is subject to the user scheduler. It does not have a dedicated kernel thread; it sleeps in user mode; it is placed on the user run queue when it is waiting for a processor; and it is subjected to time slicing by the user scheduler.

Tests on AIX 4.3.2 have shown that certain applications can perform much better with the 1:1 model.

This entry was posted in Oracle and tagged , , . Bookmark the permalink.