This section describes the HP DCE specific support, behavior, and restrictions for thread scheduling attributes.
The start policy attribute is fully supported by the HP DCE implementation of Threads.h++ and defaults to RW_THR_START_RUNNING.
OSF/DCE (POSIX 1003.1c Draft 4) compliant systems, such as HP DCE, do not support the concept of contention scope. Most of these systems have an implicit contention scope that is fixed by the underlying implementation. Threads.h++ allows you to query this attribute only in those environments where underlying contention scope is known.
In HP DCE, threads are scheduled by the underlying threads library and so have a fixed contention scope of RW_THR_PROCESS_SCOPE.
You may query the contention scope, and may set the contention scope to RW_THR_PROCESS_SCOPE, but any attempt to change the scope to RW_THR_SYSTEM_SCOPE will produce an exception.
The scheduling inheritance policy attribute is fully supported by the HP DCE implementation of Threads.h++ and defaults to RW_THR_INHERIT.
The concurrency policy attribute is not supported in the HP-UX implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
The OSF/DCE (POSIX 1003.1c Draft 4) threads API defines the following scheduling policies:
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 following table shows how Threads.h++ RWSchedulingPolicy values and priority values map to the underlying threads API policies:
Threads.h++ RWSchedulingPolicy Values | Threads.h++ Priority Values | HP DCE Scheduling Policy |
RW_THR_PREEMPTIVE |
16-31 |
SCHED_FIFO |
RW_THR_TIME_SLICED_FIXED |
16-31 |
SCHED_RR |
RW_THR_TIME_SLICED_DYNAMIC |
8-15 |
SCHED_OTHER same as: SCHED_FG_NP |
1-7* |
SCHED_BG_NP* |
* Although documented by HP, all attempts to use this underlying scheduling policy and priority range were unsuccessful, so we have dropped support for this policy and its associated priority range.
Note that Threads.h++ has mapped RW_THR_TIME_SLICED_DYNAMIC onto the HP DCE scheduling policy SCHED_OTHER.
Any attempt to set a scheduling policy value not shown on this list will result in an RWTHROperationNotAvailable exception.
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.
Threads.h++ uses the following HP DCE macro definitions to determine the legal range of priority values for each scheduling policy:
Scheduling Policy | Minimum Priority | Maximum Priority |
RW_THR_PREEMPTIVE |
PRI_FIFO_MIN |
PRI_FIFO_MAX |
RW_THR_TIME_SLICED_FIXED |
PRI_RR_MIN |
PRI_RR_MAX |
RW_THR_TIME_SLICED_DYNAMIC |
PRI_BG_MIN_NP |
PRI_OTHER_MAX |
This translates to the following priority ranges and default values:
Scheduling Policy | Minimum Priority | Maximum Priority | Default Priority |
RW_THR_PREEMPTIVE |
16 |
31 |
24 |
RW_THR_TIME_SLICED_FIXED |
16 |
31 |
24 |
RW_THR_TIME_SLICED_DYNAMIC |
1 |
15 |
12 |
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 a default priority based on the current scheduling policy value, as listed in the last column of the previous table.
The time-slice quantum attribute is not supported in the HP DCE implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
In HP DCE (POSIX 1003.1c Draft 4), support for user specification of stack attributes is limited to controlling the size of the system-managed stack; HP DCE does not support user-managed stacks.
HP DCE provides support for controlling the reserve size of a system-managed thread stack, but provides no support for controlling the commitment of physical memory and page-file space to the stack.
Stack Reserve Size. HP DCE provides support for controlling the reserve size of a system-managed stack.
HP DCE does not define a minimum stack size. The getMinStackSize() member will return the default stack size as the minimum stack size.
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 HP DCE, this default stack size is described as machine-dependent, but is typically 60KB.
To insure that each thread's stack size is always greater than the minimum allowable stack size, Threads.h++ adds the minimum stack size value to any size value retrieved from a thread attribute at the time a thread is created.
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 HP DCE implementation of Threads.h++. Attempts to get or set this attribute value will result in exceptions.
HP DCE does not support user-defined stacks. Consequently, the HP DCE implementation of Threads.h++, does not support user-defined stacks; any attempts to get or set the user stack address and size attributes will result in exceptions.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.