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 Linux POSIX 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. According to the Linux manpage sched_setscheduler(2), under Linux, this policy is “based on the nice level … and increased for each time quantum the process [i.e. thread] is unable to run.”
Note that Linux POSIX 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 7 shows how the Threads Module Linux POSIX implementation maps RWSchedulingPolicy values to the underlying POSIX 1003.1c policy values.
Table 7 – Linux: 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 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, since that value gives the most meaningful interpretation.
In order for a new thread’s scheduling policy to inherit by default from the creating thread, you must change the inheritance policy’s default value from RW_THR_EXPLICIT to RW_THR_INHERIT. If you do not set RW_THR_INHERIT, a new thread’s scheduling policy defaults to RW_THR_TIME_SLICED_DYNAMIC.