0

In operating systems of supercomputers, which handles a big quantity of tasks at the same time, is there any situation when SJF policy is taking longer than FCFS policy, speaking of waiting time metric?

It can be assumed that more than one core are present in the system.

4

1 回答 1

6

一开始我认为不可能,后来我花了一些时间,终于得出了这个结果:

是的,可以。

假设就绪队列充满了具有相等突发时间(all = x)的进程:

Process    Burst time
 P1          x
 P2          x
 P3          x
 P4          x
 .           .
 .           .
 .           .
 Pn          x

现在在这种情况下,FCFS 会做什么,首先到达的进程将被分配 CPU,然后首先到达的下一个进程将被分配 CPU,依此类推,不会浪费任何时间。

但是 SJF 会做的是:它将首先从就绪队列中的可用作业中找到具有最短突发时间的作业,在这种情况下,这是浪费时间,因为所有的突发时间都相同,并且 SJF 最终会遍历就绪队列而没有任何卓有成效的结果。

于 2015-06-29T12:39:37.993 回答