gpt4 book ai didi

linux - struct sched_pa​​ram 中的 sched_priority 指的是什么?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:18:02 25 4
gpt4 key购买 nike

我很难理解 setscheduler 函数中的 sched_priority 角色。
我使用的是 linux 2.4.X,文档说:

Valid priorities for SCHED_OTHER is 0, Valid priorities for SCHED_RR\FIFO are 1...MAX_USER_RT_PRIO-1

但是,我记得 rt 进程的优先级是 0-99,而 SCHED_OTHER 的优先级是 100-139,所以...我错过了什么? struct sched_pa​​ram 中的sched_priority 指的是什么?

最佳答案

SCHED_OTHER 是默认的循环调度策略。这是没有优先级的选择。

SCHED_FIFOSCHED_RR 是实时调度策略,其优先级范围为 1 到 99。

SCHED_OTHERSCHED_BATCHSCHED_IDLE 是正常的调度策略。

从 Linux 3.14 开始,您会发现 SCHED_DEADLINE,其中截止日期最早的任务最先执行。

您可以使用sched_priority 来设置线程优先级。 sched_priority 是结构 struct sched_pa​​ram 的成员。

尝试 chrt -m 来检查可以配置/设置的最小/最大有效优先级。 chrt 可用于设置或检索进程的调度属性。

关于linux - struct sched_pa​​ram 中的 sched_priority 指的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27076350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com