Re: [理工] OS幾個問題

看板Grad-ProbAsk作者 (野獸瘋)時間9年前 (2014/12/24 00:29), 編輯推噓3(300)
留言3則, 2人參與, 最新討論串5/5 (看更多)
問了洪逸之後才發現是我想錯了 因為這兩題很相似,所以我把數據列出來比較容易對照不同的地方 【97交大資工】 Suppose a non-preemptive scheduler uses variable priorities and time quanta as the following table,where the highest priority is 5 Priority Time quantum New priority after New priority after time quantum is expired returning from I/O ──── ────── ──────────── ───────── 5 40 4 5 4 60 3 5 3 100 2 4 2 200 1 4 1 320 1 3 Q:Response time of interactive threads will increase. ANS:若一開始的優先權值為3,則 I/O-bound job 可執行的 time quantum 依序為 100 → 60 → 40,所以 response time 會逐漸遞減 所以這個敘述是錯的 【101交大資工】 Consider the following dispatch table for time-sharing and interactive threads in a revised Unix-based operating system: Original Priority Time Quantum New Priority after New Priority after Time Quantum Expired Return from Sleep ───────── ────── ────────── ───────── 0 200 10 0 5 200 14 1 10 160 19 1 15 160 24 3 20 120 19 4 25 120 34 5 30 80 39 6 35 80 44 7 40 40 49 7 45 40 54 8 50 40 59 8 55 40 59 9 59 20 59 9 Q:This scheduling policy gives good throughput for CPU-bound processes and good response time for interactive processes. Ans:因為題目沒有說明優先權值與優先權的關係 所以洪逸是假設優先權值越高代表優先權越高 若一開始的優先權值為 30,則: (1) CPU-bound job 可執行的 time quantum 依序為 80 → ≒40 → ≒40 → 20,所以可執行的 time quantum 會逐漸遞減 所以 CPU-bound process 不會有好的 throughput (2) I/O-bound job 可執行的 time quantum 依序為 80 → ≒200 → 200 → 200,所以可執行的 time quantum 會逐漸遞增 所以 response time 會逐漸遞增 如果題目說的 "good response time" 是代表 response time 逐漸遞減的話 那後半段的敘述也是錯的,這點我忘了問洪逸,但是前半段的敘述一定是錯的 所以這個敘述是錯的 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.42.181.207 ※ 文章網址: http://www.ptt.cc/bbs/Grad-ProbAsk/M.1419352169.A.236.html

12/27 00:38, , 1F
Solaris...考有夠細, 預設prior.為最高 去翻恐龍吧
12/27 00:38, 1F

12/28 20:06, , 2F
可是Response time不是只看第一次的時間嗎?
12/28 20:06, 2F

12/28 20:12, , 3F
嗯我剛才才往上爬文 當我沒問XDD 原來前面有提到了
12/28 20:12, 3F
文章代碼(AID): #1KcPXf8s (Grad-ProbAsk)
文章代碼(AID): #1KcPXf8s (Grad-ProbAsk)