Python 3.3+Linux · macOSosfunction
os.sched_get_priority_max
os — scheduler (sched)
Return the maximum priority for a scheduling policy.
Syntax
os.sched_get_priority_max(...)
The valid range depends on the policy: on Linux SCHED_FIFO and SCHED_RR allow 1–99, while SCHED_OTHER allows exactly 0. So do not hard-code numbers — ask the system for the bounds with this function and sched_get_priority_min.
Examples
import os
print(os.sched_get_priority_max(os.SCHED_FIFO)) # → ? только Unix: верхняя граница real-time приоритетов, на Linux 99
print(os.sched_get_priority_max(os.SCHED_OTHER)) # → ? только Unix: на Linux 0 — обычной политике приоритет не назначают
lo = os.sched_get_priority_min(os.SCHED_RR) # → ? только Unix: нижняя граница того же диапазона
print(lo, os.sched_get_priority_max(os.SCHED_RR)) # → ? только Unix: на Linux «1 99» — допустимый отрезок приоритетов SCHED_RR
os.sched_get_priority_max(12345) # → OSError: [Errno 22] Invalid argument — политики с таким номером нет
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy