linux - FreeBSD 调度器和 Linux 调度器的区别

标签 linux linux-kernel

<分区>

FreeBSD 调度器和 Linux 调度器有什么区别?

最佳答案

有几个可用的调度器。此答案假定默认调度程序:CFS (Linux) 和 ULE (FreeBSD)。

CFSCompletely Fair Scheduler 的缩写。最显着的区别是 CFS 不基于运行队列进行进程选择。相反,它使用复杂度为 O(log N) 的红黑树,该树由花费的 CPU 时间索引。

另一个值得注意的细节是 CFS 使用纳秒来计算时间。来自 Kernel Trap :

CFS uses nanosecond granularity accounting and does not rely on any jiffies or other HZ detail. Thus the CFS scheduler has no notion of 'timeslices' and has no heuristics whatsoever. There is only one central tunable:

  /proc/sys/kernel/sched_granularity_ns

which can be used to tune the scheduler from 'desktop' (low latencies) to 'server' (good batching) workloads. It defaults to a setting suitable for desktop workloads. SCHED_BATCH is handled by the CFS scheduler module too.

ULE是传统 BSD 调度程序的继承者。它在 SMP 系统和单处理器系统上提供了显着改进的性能。它遵循带有运行队列和时间片的更传统的设计。它努力做到公平,但可以被指示支持交互式过程。

这是一个 link ULE 的作者在研究 CFS 源代码时的一些发现。他们还在评论中讨论了 CFS 调度程序中算法的复杂性(已引起激烈争论)。

两个调度器都适合桌面使用。通过设置 kern.sched.interact,ULE 支持交互式进程。没有它,CFS 和 ULE 应该同样公平。

ULE 大约有 3000 行代码,而 CFS 正在接近这一数字的两倍。

关于linux - FreeBSD 调度器和 Linux 调度器的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14918797/

相关文章:

linux - 无法通过 jenkins 打开 Chrome 浏览器 --- 未知错误 : Chrome failed to start: crashed

c++ - 为什么skb_transport_header计算不正确?

linux - 如何在 Unix/Linux 消息队列中设置基于 ssl 的通信?

javascript - 我无法在主机上启动 node.js

c++ - g++ -I 不按指定顺序工作

linux - 如何在 block 设备驱动程序中禁用请求合并?

linux - 在 Linux 集群中跨机器共享大型映射数据文件

c - 内核编译错误

linux - 操作系统如何抢占进程并重新获得控制权?

c - Linux 中断与轮询