📌  相关文章
📜  门| Sudo GATE 2020 Mock I(2019年12月27日)|第50章

📅  最后修改于: 2021-06-29 03:11:25             🧑  作者: Mango

考虑要计划在单个CPU系统上执行的以下作业集。

Job    Arrival Time    Size (msec)   Priority
J1             0          10         2 (Silver)
J2             2          8          1 (Gold)
J3             3          3          3 (Bronze)
J4            10          4          2 (Silver)
J5            12          1          3 (Bronze)       
J6            15          4          1 (Gold) 

以下哪项是调度策略的正确顺序,该策略为这组作业提供了最短的等待时间?
(A)非抢占式SJF (B)非抢占式SJF (C)非抢占式SJF <抢占式优先级调度(D)非抢占式SJF <抢占式优先级调度<非抢占式优先级调度答案: (C)
说明: 1.用于FCFS调度的甘特图:

Job    Arrival Time    Size (msec)    Priority   Turn around time  Waiting time 
J1             0          10         2 (Silver)     0                 0
J2             2          8          1 (Gold)       16                8
J3             3          3          3 (Bronze)     18                15
J4            10          4          2 (Silver)     15                11
J5            12          1          3 (Bronze)     14                13
J6            15          4          1 (Gold)       15                11

平均等待时间

= (0 + 8 + 15 + 11 + 13 + 11) / 6 = 9.67 

2.用于非抢先式SJF调度的甘特图:

Job    Arrival Time    Size (msec)    Priority   Turn around time  Waiting time 
J1             0          10         2 (Silver)     0                  0
J2             2          8          1 (Gold)       28                 20
J3             3          3          3 (Bronze)     10                 7
J4            10          4          2 (Silver)     8                  4
J5            12          1          3 (Bronze)     2                  1
J6            15          4          1 (Gold)       7                  3

平均等待时间

= (0 + 20 + 7 + 4 + 1 + 3) / 6 = 5.83 

3.用于非抢先优先级调度的甘特图:

Job    Arrival Time    Size (msec)    Priority   Turn around time  Waiting time 
J1             0          10         2 (Silver)     0                 0
J2             2          8          1 (Gold)       16                8
J3             3          3          3 (Bronze)     26               23
J4            10          4          2 (Silver)     16                12
J5            12          1          3 (Bronze)     18                17
J6            15          4          1 (Gold)       15                3

平均等待时间

= (0 + 8 + 23 + 12 + 17 + 3) / 6 = 10.5 

4.用于优先级优先调度的甘特图:

Job    Arrival Time    Size (msec)    Priority   Turn around time  Waiting time 
J1             0          10         2 (Silver)     0                 12
J2             2          8          1 (Gold)       8                 0
J3             3          3          3 (Bronze)     26                3
J4            10          4          2 (Silver)     16                12
J5            12          1          3 (Bronze)     18                17
J6            15          4          1 (Gold)       4                0

平均等待时间

= (12 + 0 + 3 + 12 + 17 + 0) / 6 = 7.33 

因此,非抢占式SJF <抢占式优先级调度

因此,选项(C)是正确的。
这个问题的测验