Reputation: 1011
im having some hard time understanding the sched_priority role in the setscheduler func.
Im using linux 2.4.X, and the documentation says :
Valid priorities for SCHED_OTHER is 0, Valid priorities for SCHED_RR\FIFO are 1...MAX_USER_RT_PRIO-1
But, I remember that priorities for rt procsses are 0-99, and for SCHED_OTHER 100-139, so... what did I miss ? what sched_priority
in struct sched_param
refers to?
Upvotes: 1
Views: 3981
Reputation: 15218
You are confusing the user space interface with the internal kernel implementation. sched_priority is just the requested fixed real time priority. A task scheduled under the SCHED_OTHER policy also has a nice level.
The scale you remember is the kernel internal representation of the relative priority of a task, aggregating real time tasks and SCHED_OTHER tasks with their respective nice levels.
Upvotes: 0
Reputation: 7842
SCHED_OTHER
is the default scheduling policy with round robin. This is has no choice of priority.
SCHED_FIFO
and SCHED_RR
are real time scheduling policies for which the priority range from 1 to 99.
SCHED_OTHER
, SCHED_BATCH
and SCHED_IDLE
are normal scheduling policies.
From Linux 3.14 onwards, you will find SCHED_DEADLINE
that in which the task with earliest deadline is executed first.
You can use the sched_priority
to set the thread priority. sched_priority is a member of the structure struct sched_param
.
Try out chrt -m
to check the min/max valid priorities that can be configured/set. chrt
can be used to set or retrieve scheduling attributes of processes.
Upvotes: 2