Scheduling Priority
In POSIX 1003.1c-compliant systems, support for the specification of thread priority is optional. The Threads Module determines whether scheduling priority is supported by testing for the definition of macro _POSIX_THREAD_PRIORITY_SCHEDULING.
The Linux POSIX implementation does support system-scope priority scheduling. The Threads Module uses the standard POSIX.1b (formerly 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 according to the scheduling policy, as shown in
Table 8 .
Table 8 – Linux with POSIX 1003.1c: Scheduling policy priority values
Scheduling Policy | Minimum Priority | Maximum Priority | Default Priority |
---|
RW_THR_PREEMPTIVE | 1 | 99 | 1 |
RW_THR_TIME_SLICED_FIXED | 1 | 99 | 1 |
RW_THR_TIME_SLICED_DYNAMIC | 0 | 0 | 0 |
A thread attribute reports a priority of 0, unless a priority has been explicitly set. Once a thread has been started, the priority of that thread is set to the default value specified in the table above.
Note that process-scope priority is not supported in the Linux implementation of the Threads Module because Linux POSIX does not support process-scope threads.