FreeBSD调度程序和Linux调度程序之间的区别

时间:2022-07-17 02:11:57

What are the difference between FreeBSD scheduler and Linux Scheduler ?

FreeBSD调度程序和Linux调度程序有什么区别?

1 个解决方案

#1


12  

There are several schedulers available. This answer assumes the default schedulers: CFS (Linux) and ULE (FreeBSD).

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

CFS is short for Completely Fair Scheduler. The most notable difference is that CFS is not based on run queues for process selection. Instead, it uses a red-black tree with O(log N) complexity that is indexed by CPU time spent.

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

Another notable detail is that CFS uses nanoseconds for its time accounting. From Kernel Trap:

另一个值得注意的细节是CFS在其时间计算中使用纳秒。来自内核陷阱:

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:

CFS使用纳秒粒度计算,不依赖于任何jiffies或其他HZ细节。因此,CFS调度程序没有“timeslices”的概念,也没有任何启发式方法。只有一个*可调:

  /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.

可用于将调度程序从“桌面”(低延迟)调整到“服务器”(良好的批处理)工作负载。它默认为适合桌面工作负载的设置。 SCHED_BATCH也由CFS调度程序模块处理。

ULE is the successor to the traditional BSD scheduler. It offers much improved performance on SMP systems as well as uniprocessor systems. It follows a more traditional design with run queues and time slices. It strives to be fair, but can be instructed to favor interactive processes.

ULE是传统BSD调度程序的后继者。它在SMP系统和单处理器系统上提供了大大改进的性能。它遵循更传统的设计,包括运行队列和时间片。它力求公平,但可以指示支持互动过程。

Here's a link to some findings by the author of ULE while studying CFS source. They also discuss the complexity (which has been heavily debated) of the algorithms in the CFS scheduler in the comments.

这里是ULE作者在研究CFS源代码时的一些发现的链接。他们还在评论中讨论了CFS调度程序中算法的复杂性(已经过多次辩论)。

Both schedulers are suitable for desktop use. With kern.sched.interact set, ULE favors interactive processes. Without it, CFS and ULE should be equally fair.

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

ULE lands at roughly 3000 lines of code, while CFS is pushing close to the double of that.

ULE落后大约3000行代码,而CFS正在接近其中的两倍。

#1


12  

There are several schedulers available. This answer assumes the default schedulers: CFS (Linux) and ULE (FreeBSD).

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

CFS is short for Completely Fair Scheduler. The most notable difference is that CFS is not based on run queues for process selection. Instead, it uses a red-black tree with O(log N) complexity that is indexed by CPU time spent.

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

Another notable detail is that CFS uses nanoseconds for its time accounting. From Kernel Trap:

另一个值得注意的细节是CFS在其时间计算中使用纳秒。来自内核陷阱:

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:

CFS使用纳秒粒度计算,不依赖于任何jiffies或其他HZ细节。因此,CFS调度程序没有“timeslices”的概念,也没有任何启发式方法。只有一个*可调:

  /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.

可用于将调度程序从“桌面”(低延迟)调整到“服务器”(良好的批处理)工作负载。它默认为适合桌面工作负载的设置。 SCHED_BATCH也由CFS调度程序模块处理。

ULE is the successor to the traditional BSD scheduler. It offers much improved performance on SMP systems as well as uniprocessor systems. It follows a more traditional design with run queues and time slices. It strives to be fair, but can be instructed to favor interactive processes.

ULE是传统BSD调度程序的后继者。它在SMP系统和单处理器系统上提供了大大改进的性能。它遵循更传统的设计,包括运行队列和时间片。它力求公平,但可以指示支持互动过程。

Here's a link to some findings by the author of ULE while studying CFS source. They also discuss the complexity (which has been heavily debated) of the algorithms in the CFS scheduler in the comments.

这里是ULE作者在研究CFS源代码时的一些发现的链接。他们还在评论中讨论了CFS调度程序中算法的复杂性(已经过多次辩论)。

Both schedulers are suitable for desktop use. With kern.sched.interact set, ULE favors interactive processes. Without it, CFS and ULE should be equally fair.

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

ULE lands at roughly 3000 lines of code, while CFS is pushing close to the double of that.

ULE落后大约3000行代码,而CFS正在接近其中的两倍。