简体   繁体   English

Linux内核调度

[英]Linux kernel scheduling

我想知道老Linux调度算法SJF(最短作业优先)如何计算进程运行时?

This problem actually is one of the major reasons why it is rarely used in common environments, since SJF algorithm requires accurate estimate of the runtime of all processes, which is only given in specialized environments. 这个问题实际上是它很少在常见环境中使用的主要原因之一,因为SJF算法需要准确估计所有进程的运行时间,这仅在专门环境中给出。

In common situations you can only get estimated and inaccurate length of process running time, for example, by recording the length of previous CPU bursts of the same process, and use mathematical approximation methods to calculate how long it will run next time. 在常见情况下,您只能获得估计且不准确的进程运行时间长度,例如,通过记录同一进程的先前CPU突发的长度,并使用数学近似方法计算下次运行的时间长度。

If you have some bandwidth to burn, you might be able to find the actual code here . 如果您有一些要刻录的带宽,您可以此处找到实际代码。 Start at 2.0, where I think you'll find it as experimental. 从2.0开始,我认为你会发现它是实验性的。

SJF was (IIRC) extremely short lived, for the exact reasons that ZelluX noted . 由于ZelluX指出的确切原因,SJF (IIRC)的生命非常短暂。

I think your only hope to understand the method behind its madness lives in the code at this point. 我认为你理解其疯狂背后的方法的唯一希望就是生活在代码中。 You may be able to build it and get it to boot in a simulator. 可以构建它并让它在模拟器中启动。

Edit: 编辑:

I'm now not completely sure if it ever did go into mainline. 我现在还不完全确定它是否进入主线。 If you can't find it, don't blame me :) 如果你找不到它,不要怪我:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM