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

📅  最后修改于: 2021-09-25 04:07:52             🧑  作者: 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) 

以下哪一项是为这组作业提供最短等待时间的调度策略的正确顺序?
(一)非抢占式SJF(B)非抢占式 SJF < FCFS < 抢占式优先级调度 < 非抢占式优先级调度
(C)非抢占式 SJF < 抢占式优先级调度 < FCFS < 非抢占式优先级调度
(D)非抢占式 SJF < 抢占式优先级调度 < 非抢占式优先级调度 < FCFS
答案: (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 < 抢占式优先级调度 < FCFS < 非抢占式优先级调度。

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