The following sections describe the specific support, behavior, and restrictions for thread scheduling attributes under IRIX64 version 6.5.
The start policy attribute is fully supported by the IRIX implementation of Threads.h++ and defaults to RW_THR_START_RUNNING.
In POSIX 1003.1c-compliant systems, support for contention scope is optional. Threads.h++ determines whether contention scope is supported by testing for the definition of the macro _POSIX_THREAD_PRIORITY_SCHEDULING. Even if the API indicates that priority scheduling is supported, the environment may only allow one policy.
The IRIX64 version 6.5 implementation of POSIX 1003.1c supports both process and system scope threads. The Threads.h++ IRIX implementation maps its RWContentionScope values to the underlying POSIX 1003.1cAPI as follows:
Threads.h++ RWContentionScope | POSIX 1003.1c Contention Scope |
RW_THR_PROCESS_SCOPE |
PTHREAD_SCOPE_PROCESS |
RW_THR_SYSTEM_SCOPE |
PTHREAD_SCOPE_SYSTEM (process requires CAP_SCHED_MGT) |
A process may only create a system-scope thread if it possesses the CAP_SCHED_MGT capability. If a process does not have this capability, attempts to set RW_THR_SYSTEM_SCOPE will result in exceptions.
The scheduling inheritance policy attribute is fully supported by the IRIX implementation of Threads.h++ and defaults to RW_THR_INHERIT.
The concurrency policy attribute is not supported in the IRIX implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
In POSIX 1003.1c compliant systems, support for the specification of scheduling policy is optional. Threads.h++ determines whether scheduling policy is supported by testing for the definition of the macro _POSIX_THREAD_PRIORITY_SCHEDULING. Even if the API indicates that priority scheduling is supported, the environment may not support all policies.
The IRIX64 version 6.5 implementation of the POSIX 1003.1c threads API supports all three scheduling policies as defined by the standard:
SCHED_FIFO - Specifies FIFO scheduling, where threads run until preempted by a thread of higher priority, or until blocked. Thread priorities are set by the application; the system does not dynamically change a thread's priority.
SCHED_RR - Selects round-robin scheduling, where the highest-priority thread runs until preempted by a thread of higher priority, until some time-quantum has elapsed, or until blocked. Threads possessing the same priority value are time-sliced and scheduled in a round-robin fashion. Thread priorities are set by the application; the system does not dynamically change a thread's priority.
SCHED_OTHER - Selects the default scheduling policy for an implementation. This policy typically uses time-slicing with dynamic adjustments to priority and/or time-slice quantum.
The Threads.h++ IRIX64 version 6.5 implementation maps its RWSchedulingPolicy values to the underlying POSIX 1003.1c policy values as follows:
Threads.h++ RWSchedulingPolicy | 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 be used to set) |
SCHED_OTHER |
Attempts to set any other scheduling policy value will result in an RWTHROperationNotAvailable exception.
Note that Threads.h++ has mapped two policy values to the same underlying policy, SCHED_OTHER. Calls to getSchedulingPolicy() will return RW_THR_TIME_SLICED_DYNAMIC since that value gives the most meaningful interpretation.
A new thread's scheduling policy is inherited from the creating thread by default, unless the scheduling policy 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_INHERIT, and you query for the default policy, Threads.h++ will return the scheduling policy used by the calling thread. If the inheritance policy is RW_THR_EXPLICIT, Threads.h++ defines the default scheduling policy to be RW_THR_TIME_SLICED_DYNAMIC.
In POSIX 1003.1c-compliant systems, support for the specification of thread priority is optional. Threads.h++ determines whether scheduling priority is supported by testing for the definition of the macro _POSIX_THREAD_PRIORITY_SCHEDULING.
The IRIX64 version 6.5 implementation does support priority scheduling. Threads.h++ uses the 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 by scheduling policy as shown in the following table:
Scheduling Policy | Minimum Priority | Maximum Priority | Default Priority |
RW_THR_PREEMPTIVE |
0 |
255 |
0 |
RW_THR_TIME_SLICED_FIXED |
0 |
255 |
0 |
RW_THR_TIME_SLICED_DYNAMIC |
1 |
40 |
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_INHERIT, and you query for the default priority, Threads.h++ will return the priority of the calling thread. If the inheritance policy is RW_THR_EXPLICIT, Threads.h++ defines the default priority to be 0 or 1 depending on the policy selected.
The time-slice quantum attribute is not supported in the IRIX64 version 6.5 implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
In POSIX 1003.1c-compliant systems, support for user specification of stack attributes is optional. IRIX supports size control for a system-managed stack, and supports user-managed stacks.
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.
Stack Reserve Size. In POSIX 1003.1c-compliant systems, support for user specification of stack reserve size is optional. Threads.h++ determines the support for stack reserve size by testing for the definition of the standard POSIX macro _POSIX_THREAD_ATTR_STACKSIZE.
The IRIX64 version 6.5 POSIX implementation does support the stack reserve size attribute for a system-managed stack.
Threads.h++ uses the POSIX macro, PTHREAD_STACK_MIN, to determine recommended minimum size for a thread stack. IRIX defines this value to be 16KB. This is the value that will be returned by the getMinStackSize() member.
If you query for the default stack reserve size, Threads.h++ uses the pthread_attr_getstacksize() function to retrieve the default stack size defined by an initialized pthread_attr_t instance. Under this implementation, the default stack size is 128KB.
Threads.h++ imposes no upper limit for stack reserve size; the maximum stack size is effectively limited by available virtual memory space and page-file size. If the stack reserve size specified is too large for the available resources, an exception will be produced at the time a thread is created using the thread attribute instance with the offending reserve size value.
Stack Commit Size. The stack commit size attribute is not supported in the IRIX implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
In POSIX 1003.1c compliant systems, support for user-defined stacks is optional. Threads.h++ determines the support for user-defined stacks by testing for the definition of the standard POSIX macro _POSIX_THREAD_ATTR_STACKADDR.
The IRIX64 version 6.5 implementation of Threads.h++ 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.
Threads.h++ imposes no upper limit for user stack size; the maximum stack size is effectively limited by the virtual memory space 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.
A call to setStackReserveSize() replaces or nullifies the attribute settings produced by any previous call to setUserStack() and vice versa.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.