Linux内核调度
我想知道旧的Linux调度算法SJF(最短作业优先)如何计算进程运行时间?
I wish to know how Old Linux scheduling algorithm SJF (shortest job first) calculates the process runtime ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题实际上是它很少在常见环境中使用的主要原因之一,因为SJF算法需要准确估计所有进程的运行时间,而这只有在专门的环境中才会给出。
通常情况下,你只能得到估计的、不准确的进程运行时间长度,例如,通过记录同一进程之前CPU突发的长度,并使用数学近似的方法来计算下一次运行的时间。
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.
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.
如果您有一些带宽需要消耗,您可能能够找到实际的代码此处。从 2.0 开始,我认为您会发现它是实验性的。
SJF (IIRC) 极其短暂存在,原因正是 ZelluX注意到。
我认为此时您了解其疯狂背后的方法的唯一希望就在于代码中。您也许能够构建它并使其在模拟器中启动。
编辑:
我现在不完全确定它是否确实进入了主线。如果你找不到,别怪我:)
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.
SJF was (IIRC) extremely short lived, for the exact reasons that ZelluX noted.
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 :)