Scheduling Time-Slice Quantum
Under Solaris, the time-slice quantum attribute is only supported when the contention scope is RW_THR_SYSTEM_SCOPE, and the scheduling policy is RW_THR_TIME_SLICED_FIXED. Attempts to get or set this attribute value under other circumstances will result in exceptions.
The Threads Module accepts time-slice quantum values as an unsigned long number of milliseconds. The library converts milliseconds into seconds and nanoseconds so the value can be passed to the Solaris priocntl() function using the real-time class parameters structure. The Threads Module allows you to specify the quantum with an accuracy of 1 millisecond; the system, however, will round the value to the next largest integral multiple of the system clock’s resolution.
The minimum time-slice quantum allowed by the Threads Module under Solaris is 1 millisecond. The maximum is limited by to the largest number of milliseconds that can be represented by an unsigned long. If an infinite time-slice quantum is desired the RW_THR_PREEMPTIVE scheduling policy should be used.
If supported under current circumstances, a new thread’s time-slice quantum value is inherited from the creating thread, unless the time-slice quantum attribute has been explicitly set or the inheritance policy has been set to RW_THR_EXPLICIT. If the inheritance policy is RW_THR_INHERIT, and you query for the default time-slice quantum, The Threads Module will return the time-slice quantum value of the calling thread. If the calling thread does not have a time-slice quantum to query (because it does not have the proper contention scope or scheduling policy), the query will fail with an exception. If the inheritance policy is RW_THR_EXPLICIT, the Threads Module will ask the operating system to use the default time-slice quantum for the current priority level. This default value may not be queried, and any attempts to do so will result in an exception.
The following table summarizes the relationship between contention scope, scheduling policy, and the time-slice quantum attribute:
Table 11 – Solaris native thread support: Summary of the relationship between contention scope, scheduling policy and the time-slice quantum attribute
Contention Scope
Scheduling Policy
Default Time-Slice Quantum
Process
RW_THR_PREEMPTIVE
N/A
RW_THR_TIME_SLICED_DYNAMIC
N/A
System
RW_THR_TIME_SLICED_FIXED
Inherited or System Default
RW_THR_PREEMPTIVE
N/A (Infinite)