[置顶] 泰晓 RISC-V 实验箱,配套 30+ 讲嵌入式 Linux 系统开发公开课
[置顶] Linux Lab v1.4 升级部分内核到 v6.10,新增泰晓 RISC-V 实验箱支持,新增最小化内核配置支持大幅提升内核编译速度,在单终端内新增多窗口调试功能等Linux Lab 发布 v1.4 正式版,升级部分内核到 v6.10,新增泰晓实验箱支持
[置顶] 泰晓社区近日发布了一款儿童益智版 Linux 系统盘,集成了数十个教育类与益智游戏类开源软件国内首个儿童 Linux 系统来了,既可打字编程学习数理化,还能下棋研究数独提升智力
LWN 433904: 一个 “组调度(group scheduling)” 的运行实例
请点击 LWN 中文翻译计划,了解更多详情。
原文:A group scheduling demonstration 原创:By Jonathan Corbet @ Mar. 16, 2011 翻译:By unicornx 校对:By Xiaojie Yuan
There has been much talk of the per-session group scheduling patch which is part of the 2.6.38 kernel, but it can be hard to see that code in action if one isn’t doing a 20-process kernel build at the time. Recently, your editor inadvertently got a demonstration of group scheduling thanks to some unexpected results from a Rawhide system upgrade. The way the scheduler works was clearly shown in a way that could be captured at the time.
“基于会话(session)的组调度“ 这个补丁自从随 2.6.38 版本被合入内核后已经引发了不少的讨论,但如果你还没有真正尝试过诸如同时运行二十个进程来编译内核这样的工作,那么你是很难体会到这个补丁所带来的实际效果的。最近,在执行 Rawhide 系统升级的过程中(Rawhide 是 Fedora 的一个开发版本的代号。具体参考 Rawhide 的 wiki 介绍),我无意中见识到了组调度所展现的魅力。调度器触发了该项功能并且其现场也被我清晰地记录了下来。
Rawhide users know that surprises often lurk behind the harmless-looking
yum upgrade
command. In this particular case, something in the upgrade (related to fonts, possibly) caused every graphical process in the system to decide that it was time to do some heavy processing. The result can be seen in this output from thetop
command:
只要你是 Rawhide 的用户,应该了解那个看似简单的 yum upgrade
命令执行后可能会给我们带来的 “惊喜”。在我碰到的这次升级事件中,某些升级的内容(可能与字体有关)导致系统中的每个和图形显示有关的进程都开始变得忙碌起来。通过运行 top
命令看到了如下的输出结果:
The per-session heuristic had put most of the offending processes into a single control group, with the effect that they were mostly competing against each other for CPU time. These processes are, in the capture above, each currently getting 5.3% of the available CPU time. Two processes which were not in that control group were left essentially competing for the second core in the system; they each got 46%. The system had a load average of almost 22, and the desktop was entirely unresponsive. But it was possible to log into the system over the net and investigate the situation without really even noticing the load.
基于会话对任务尝试进行分组的方法将大多数受到升级影响的进程都加入到同一个控制组(control group)中(译者注,因为这些和图形终端有关的进程都属于当前登录会话),使得它们在一个组内相互竞争处理器时间。在上面的截屏快照中,我们可以看到这些进程各分得了可用处理器时间的 5.3%(译者注,看上去 cobert 的这台机器上有两个处理器 core,和登录会话相关的进程所在的组使用了其中的一个 core)。不在该控制组中的两个进程被分配到系统中的另个一 core 上并竞争该处理器;每个得到该处理器时间的 46%。系统的平均负载接近 22(译者注,指长时间运行下系统总进程数的平均值),此时桌面几乎完全没有响应。但是我们仍然可以通过网络方式登录系统并查看系统的运行状态,而不会受到其他繁忙运行的任务的影响。
This isolation is one of the nicest features of group scheduling; even when a large number of processes go totally insane, their ability to ruin life for other tasks on the machine is limited. That, alone, justifies the cost of this feature.
这种对任务的隔离功能是 “组调度” 所能够提供的最好特性之一;即使系统中存在大量疯狂运行的进程,它们也不会过多地干扰机器上其他任务的正常运行。仅此一点就证明了 “组调度” 这个特性自身的价值。
请点击 LWN 中文翻译计划,了解更多详情。
猜你喜欢:
- 我要投稿:发表原创技术文章,收获福利、挚友与行业影响力
- 知识星球:独家 Linux 实战经验与技巧,订阅「Linux知识星球」
- 视频频道:泰晓学院,B 站,发布各类 Linux 视频课
- 开源小店:欢迎光临泰晓科技自营店,购物支持泰晓原创
- 技术交流:Linux 用户技术交流微信群,联系微信号:tinylab
支付宝打赏 | 微信打赏 | |
请作者喝杯咖啡吧 |
Read Album:
- LWN 531148: Linux 内核文件中的非常规节
- Linux 内核的代码仓库管理与开发流程简介
- LWN 600644: 扩展内核栈
- LWN 563185: 优化抢占
- LWN 575497: 我们很快就可以有 Deadline 调度器了吗?