# 2.3.8 CFS

内核在2.6.23版中引入了CFS(Completely Fair Scheduler)以取代O(1)调度器，CFS吸取了RSDL中关于公平调度的思想，着力于改善调度器在交互性与公平性两方面的性能。CFS 的设计思路发生了很大的变化，完全切换了一个方向来思考“公平”这件事情。调度器抛弃了基于时间片来划分调度周期的做法，引入了vruntime(虚拟时间) 的概念来度量公平，并使用红黑树来管理任务；同时该版本也引入了\[\[调度类 - Sched Class]\[调度类]]的概念，从而将调度器的实现模块化，从此以后内核引入新调度器的难度大为降低。

CFS现在依然是内核的核心，所有普通类任务（SCHED\_NORMAL）的调度都是CFS来完成的。除此之外，基于调度类的思想内核还实现了其他调度器，例如Deadline调度器与RT调度器，在后续章节中我们会逐一详细介绍。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://s3.shizhz.me/linux-sched/history/cfs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
