Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Platform Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.2 AIX POSIX 1003.1c Thread Attribute Support

This section describes the AIX POSIX 1003.1c thread attribute support.

2.2.1 Scheduling Attributes

This section describes the AIX POSIX 1003.1c implementation-specific support, behavior, and restrictions for thread scheduling attributes.

2.2.1.1 Start Policy

The start policy attribute is fully supported by the AIX implementation of the Threads Module and defaults to RW_THR_START_RUNNING.

2.2.1.2 Contention Scope

In POSIX 1003.1c-compliant systems, support for contention scope is optional. Even if the API indicates that priority scheduling is supported, the environment may only allow one policy.

The AIX implementation of POSIX 1003.1c supports both process and system scope threads. The Threads Module maps its RWContentionScope values to the underlying POSIX 1003.1c API as follows:

Table 1: AIX: Mapping of RWContentionScope to POSIX 1003.1c values

Threads Module RWContentionScope POSIX 1003.1c Contention Scope
RW_THR_PROCESS_SCOPE PTHREAD_SCOPE_PROCESS
RW_THR_SYSTEM_SCOPE PTHREAD_SCOPE_SYSTEM

2.2.1.3 Scheduling Inheritance Policy

The scheduling inheritance policy attribute is fully supported by the AIX implementation of the Threads Module and defaults to RW_THR_INHERIT.

2.2.1.4 Concurrency Policy

The concurrency policy attribute is not supported in the AIX implementation of the Threads Module. Attempts to get or set this attribute value will result in exceptions.

2.2.1.5 Scheduling Policy

In POSIX 1003.1c-compliant systems, support for scheduling policy is optional. The Threads Module determines whether scheduling policy is supported by testing for the definition of the macro _POSIX_THREAD_PRIORITY_SCHEDULING.

The AIX implementation of the Threads Module supports all three scheduling policies as defined by the standard:

Note that the AIX POSIX implementation limits the scheduling policies SCHED_RR and SCHED_FIFO to processes with superuser privileges. Therefore, the RWSchedulingPolicy values RW_THR_PREEMPTIVE and RW_THR_TIME_SLICED_FIXED are limited to superusers as well.

Table 2 shows how the Threads Module AIX POSIX implementation maps RWSchedulingPolicy values to the underlying POSIX 1003.1c policy values.

Table 2: AIX: Mapping of RWSchedulingPolicy to POSIX 1003.1c values

Threads Module RWSchedulingPolicy Values POSIX 1003.1c Scheduling Policy
RW_THR_PREEMPTIVE SCHED_FIFO
RW_THR_TIME_SLICED_FIXED SCHED_RR
RW_THR_TIME_SLICED_DYNAMIC(RW_THR_OTHER may also be used to set) SCHED_OTHER

Attempts to set any other policy values result in an RWTHROperationNotAvailable exception. None of these policies may be explicitly requested unless the process has superuser privileges.

Note that the Threads Module has mapped two policy values to the same underlying policy, SCHED_OTHER. Calls to getSchedulingPolicy() return RW_THR_TIME_SLICED_DYNAMIC because that value gives the most meaningful interpretation.

2.2.1.6 Scheduling Priority

In POSIX 1003.1c-compliant systems, support for the specification of thread priority is optional. The Threads Module determines whether scheduling priority is supported by testing for the definition of the macro _POSIX_THREAD_PRIORITY_SCHEDULING.

The AIX POSIX implementation does support priority scheduling. The Threads Module uses the standard POSIX.1b (formerly POSIX.4) functions sched_get_priority_min() and sched_get_priority_max() to determine the legal range of priority values.

Under this implementation, the priorities vary according to the scheduling policy, as shown in Table 3.

Table 3: AIX with POSIX 1003.1c: Scheduling policy priority values

Scheduling Policy Minimum Priority Maximum Priority Default Priority
RW_THR_PREEMPTIVE 1 127 1
RW_THR_TIME_SLICED_FIXED 1 127 1
RW_THR_TIME_SLICED_DYNAMIC 1 127 1

A new thread's priority value is inherited from the creating thread by default, unless the priority attribute has been explicitly set, or the inheritance policy has been changed from its default value of RW_THR_INHERIT to RW_THR_EXPLICIT. If the inheritance policy is RW_THR_EXPLICIT, the Threads Module defines the default priority to be the minimum priority.

The AIX POSIX threads implementation ignores attempts to set the priority if the thread scope is RW_THR_SYSTEM_SCOPE and the scheduling policy is RW_THR_TIME_SLICED_DYNAMIC. Threads with this scheduling policy are subject to continuous priority adjustments.

The allowed range of priorities on AIX is different from the priorities that are actually used. A priority in the range of 1 to 39 results in a priority of 40, and a priority in the range of 81 to 127 results in a priority of 80. So the effective range of priority values is 40 to 80. Only privileged users can set a priority greater than 60.

2.2.1.7 Scheduling Time-Slice Quantum

The time-slice quantum attribute is not supported in the AIX implementation of the Threads Module. Attempts to get or set this attribute value will result in exceptions.

2.2.2 Stack Attributes

In POSIX 1003.1c-compliant systems, support for user specification of stack attributes is optional. AIX supports size control for a system-managed stack, and supports user-managed stacks.

2.2.2.1 System-Managed Stack Attributes

POSIX 1003.1c-compliant systems provide optional support for controlling the reserve size of a system-managed stack, but provide no support for controlling the commitment of physical memory and page-file space to a thread stack.

2.2.2.2 User-Managed Stack Attributes

In POSIX 1003.1c-compliant systems, support for user-defined stacks is optional. The Threads Module determines the support for user-defined stacks by testing for the definition of the standard POSIX macro _POSIX_THREAD_ATTR_STACKADDR.

The Threads Module on AIX supports user-managed stacks.

If an attempt is made to set the user stack address to zero, or to set the user stack size to a value less than the minimum stack size returned by the getMinStackSize() function, a RWTHRBoundsError exception is produced.

The Threads Module imposes no upper limit for user stack size; the maximum stack size is effectively limited by the virtual memory and pagefile size available to the user.

Attempts to query for a default user-stack address value or user-stack size value will result in an RWTHROperationNotAvailable exception. These values may only be queried after they have been set.

The user-managed stack attribute and stack reserve size stack attribute are mutually exclusive, therefore, a call to setStackReserveSize() replaces or nullifies the attribute settings produced by any previous call to setUserStack() and vice versa.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.