内容简介
#include <sched.h>int sched_get_priority_max(int%uA0policy)
int sched_get_priority_min(int%uA0policy)
DESCRIPTION
sched_get_priority_max() returns the maximum priority value that can be used with the scheduling algorithm identified by%uA0policy.%uA0sched_get_priority_min() returns the minimum priority value that can be used with the scheduling algorithm identified bypolicy. Supported%uA0policy%uA0values are%uA0SCHED_FIFO,%uA0SCHED_RR,%uA0SCHED_OTHER, andSCHED_BATCH. Further details about these policies can be found insched_setscheduler(2).Processes with numerically higher priority values are scheduled before processes with numerically lower priority values. Thus, the value returned bysched_get_priority_max() will be greater than the value returned by%uA0sched_get_priority_min().
Linux allows the static priority value range 1 to 99 for%uA0SCHED_FIFO%uA0and%uA0SCHED_RR%uA0and the priority 0 for%uA0SCHED_OTHER%uA0and%uA0SCHED_BATCH. Scheduling priority ranges for the various policies are not alterable.
The range of scheduling priorities may vary on other POSIX systems, thus it is a good idea for portable applications to use a virtual priority range and map it to the interval given by%uA0sched_get_priority_max() and%uA0sched_get_priority_min(). POSIX.1-2001 requires a spread of at least 32 between the maximum and the minimum values forSCHED_FIFO%uA0and%uA0SCHED_RR.
POSIX systems on which%uA0sched_get_priority_max() and%uA0sched_get_priority_min() are available define%uA0_POSIX_PRIORITY_SCHEDULING%uA0in <unistd.h>.
返回值
On success,%uA0sched_get_priority_max() and%uA0sched_get_priority_min() return the maximum/minimum priority value for the named scheduling policy. On error, -1 is returned, and%uA0errno%uA0is set appropriately.错误
标签 | 描述 |
---|---|
EINVAL | 参数策略不识别定义的调度策略。 |