Linux SCHED_OTHER、SCHED_FIFO 和 SCHED_RR - 差异 [英] Linux SCHED_OTHER, SCHED_FIFO and SCHED_RR - differences
问题描述
谁能解释一下 SCHED_OTHER、SCHED_FIFO 和 SCHED_RR 之间的区别?
Can someone explain the differences between SCHED_OTHER, SCHED_FIFO and SCHED_RR?
谢谢
推荐答案
SCHED_FIFO 和 SCHED_RR 是所谓的实时"策略.它们实现了 POSIX 标准规定的固定优先级实时调度.具有这些策略的任务会抢占其他所有任务,因此很容易陷入饥饿状态(如果它们不释放 CPU).
SCHED_FIFO and SCHED_RR are so called "real-time" policies. They implement the fixed-priority real-time scheduling specified by the POSIX standard. Tasks with these policies preempt every other task, which can thus easily go into starvation (if they don't release the CPU).
SCHED_FIFO 和 SCHED_RR 的区别在于,在相同优先级的任务中,SCHED_RR 执行具有一定时间片的循环;相反,SCHED_FIFO 需要任务显式让出处理器.
The difference between SCHED_FIFO and SCHED_RR is that among tasks with the same priority, SCHED_RR performs a round-robin with a certain timeslice; SCHED_FIFO, instead, needs the task to explicitly yield the processor.
SCHED_OTHER 是常用的循环分时调度策略,根据系统中运行的其他任务,将某个任务调度到某个时间片.
SCHED_OTHER is the common round-robin time-sharing scheduling policy that schedules a task for a certain timeslice depending on the other tasks running in the system.
更新:自 Linux 3.14 起,还有一项名为 SCHED_DEADLINE一>.此策略在最早截止日期优先队列之上实施恒定带宽服务器 (CBS) 算法.此策略下的每个任务都分配了一个截止日期,并执行最早截止日期的任务.描述此算法的最佳资源是Linux 内核中的截止日期调度.
Update: since Linux 3.14, there is an additional policy called SCHED_DEADLINE. This policy implements the Constant Bandwidth Server (CBS) algorithm on top of Earliest Deadline First queues. Each task under this policy is assigned a deadline, and the earliest-deadline task is executed. The best resource describing this algorithm is Deadline scheduling in the Linux kernel.
更新 2:自 Linux 4.13 起,SCHED_DEADLINE 已用 Greedy Reclamation of未使用的带宽 (GRUB) 算法.
Update 2: since Linux 4.13, SCHED_DEADLINE has replaced CBS with the Greedy Reclamation of Unused Bandwidth (GRUB) algorithm.
这篇关于Linux SCHED_OTHER、SCHED_FIFO 和 SCHED_RR - 差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!