操作系统如何知道进程的执行时间

时间:2012-10-13 10:47:04

标签: operating-system

我正在重新审视操作系统CPU的作业调度,突然出现了一个问题,操作系统如何知道执行前的进程执行时间,我的意思是调度算法,如SJF(最短作业优先),如何过程的执行时间是先验计算的吗?

2 个答案:

答案 0 :(得分:1)

来自维基百科:

Another disadvantage of using shortest job next is that the total execution time of a job must be known before execution. While it is not possible to perfectly predict execution time, several methods can be used to estimate the execution time for a job, such as a weighted average of previous execution times.[1]

更多关于http://en.wikipedia.org/wiki/Shortest_job_next

答案 1 :(得分:1)

此外,O.S可以通过首先计算其CPI来计算每项任务所需的总时间。

(CPI:每条指令的周期数)

每项工作都有加权平均CPI。 例如,浮点指令的重量远远超过定点指令,这意味着它们需要更多时间来执行。因此,处理定点操作的工作:如添加或增加被认为更短。因此,在最短的工作中,它应在上述工作之前执行。

相关问题