在linux下SCHED_FIFO和SCHED_RR分享其中至少从0到99(99为最高),在用户空间实时priorites。从现在开始,我假设你正在谈论这些优先级(rt_priority)而不是内部prio字段。鉴于此信息在这里您的情况应该工作如何:
- 因为99是高会抢占任务90的FIFO任务,除非抢占由任务禁用。
- 没有,因为优先权50是少不应该是它能够抢占优先级的任务99
- 是再次的优先级99是高所以应该,如果你抢占优先级的任务50
最后感到困惑PRIO之间,在这里rt_prio是它们之间的关系,它可以在功能上可以找到normal_prio
/*
* Calculate the expected normal priority: i.e. priority
* without taking RT-inheritance into account. Might be
* boosted by interactivity modifiers. Changes upon fork,
* setprio syscalls, and whenever the interactivity
* estimator recalculates.
*/
static inline int normal_prio(struct task_struct *p)
{
int prio;
if (task_has_dl_policy(p))
prio = MAX_DL_PRIO-1;
else if (task_has_rt_policy(p))
prio = MAX_RT_PRIO-1 - p->rt_priority; // This is for FIFO/RR Tasks
else
prio = __normal_prio(p);
return prio;
}
为什么不尝试这些看? –
嗨,相信我,我想到了这一点,不仅仅是现在,而是对于过去的各种问题。有时候,你需要非常清楚你正在测试的内容,才能正确地进行测试,并提取正确的结论。我正在寻找回应这个理论的答案,并且基于经验和对这个具体问题的知识。 – Sagi2313