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:
*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 threads runs until preempted by a thread of higher priority, until some time-quantum has elapsed, or until blocked. Threads possessing the same priority value get 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.
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.