Linux内核中的调度策略 [英] Scheduling policies in Linux Kernel

查看:249
本文介绍了Linux内核中的调度策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux内核中可以同时运行两个以上的调度策略吗? FIFO和Round Robin可以在同一台机器上工作吗?

Can there be more than two scheduling policies working at the same time in Linux Kernel ? Can FIFO and Round Robin be working on the same machine ?

推荐答案

是的,Linux支持至少4种不同的任务调度方法:SCHED_BATCH,SCHED_FAIR,SCHED_FIFO和SCHED_RR.

Yes, Linux supports no less then 4 different scheduling methods for tasks: SCHED_BATCH, SCHED_FAIR, SCHED_FIFO and SCHED_RR.

无论采用哪种调度方法,所有任务都具有固定的硬优先级(对于批处理和公平调度,其优先级为0;对于FIFO和RR的RT调度方法,其优先级为1-99).优先级最高的任务是优先任务-最高优先级获胜.

Regardless of scheduling method, all tasks also have a fixed hard priority (which is 0 for batch and fair and from 1- 99 for the RT schedulign methods of FIFO and RR). Tasks are first and foremost picked by priority - the highest priority wins.

但是,有几个任务可以以相同的优先级运行 ,这就是调度方法的开始:公平的任务只会按其分配的权重运行(权重来自软优先级称为任务优先级")相对于其他公平任务的CPU时间份额,FIFO任务将运行固定的时间片,然后再屈服于另一个任务(具有相同优先级-优先级较高的任务始终获胜),而RR任务将一直运行到它阻止忽略具有相同优先级的其他任务.

However, with several tasks available for running with the same priority, that is where the scheduling method kicks in: A fair task will only run for its allotted weighted (with the weight coming from a soft priority called the task nice level) share of the CPU time with regard to other fair tasks, a FIFO task will run for a fixed time slice before yielding to another task (of the same priority - higher priority tasks always wins) and RR tasks will run till it blocks disregarding other tasks with the same priority.

请注意,我上面所写的内容是准确的,但并不完整,因为它没有考虑高级的CPU预留功能,但是提供了有关彼此之间进行交互的各种调度方法的详细信息.

Please note what I wrote above is accurate but not complete, because it does not take into account advance CPU reservation features, but it give the details about different scheduling method interact with each other.

这篇关于Linux内核中的调度策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆