Python 3.3+Linux · macOSosterm
os.sched_param
os — scheduler (sched)
A container type for scheduling parameters (sched_priority).
Syntax
os.sched_param(...)
An immutable container with a single field, sched_priority: os.sched_param(10). It is passed to sched_setscheduler and sched_setparam and returned by sched_getparam. The value must lie within the range reported by sched_get_priority_min and sched_get_priority_max for the chosen policy.
Examples
import os
p = os.sched_param(0); print(p) # → ? только Unix: posix.sched_param(sched_priority=0)
print(p.sched_priority) # → 0 — единственное поле контейнера
print(os.sched_get_priority_min(os.SCHED_RR), os.sched_get_priority_max(os.SCHED_RR)) # → ? только Unix: 1 99 — допустимый диапазон sched_priority в Linux
os.sched_setscheduler(0, os.SCHED_RR, os.sched_param(10)) # → ? только Unix: PermissionError без прав root; с root процесс переходит в round-robin с приоритетом 10
os.sched_setparam(0, os.sched_param(5)) # → ? только Unix: OSError [Errno 22] Invalid argument — под SCHED_OTHER приоритет обязан быть нулевым
See also
Open in the full glossarydocs.python.orgReport an inaccuracy