看板 Grad-ProbAsk 關於我們 聯絡資訊
Consider a system running ten I/O-bound tasks and one CPU-bound task. Assume that the I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that each I/O operation takes 10 millisecond to compute.Also assume that the context-switching overhead is 0.1 millisecond and that all processes are long-running tasks. Describe the CPU utilization for a round-robin scheduler when: (a)The time quantum is 1 millisecond (b)The time quantum is 10 milliseconds -- sol: (a) 1.0/(1.0+0.1) = 1/1.1 = 91% (b) 20/((10*1.1)+10.1) = 20/21.1 = 94% -- 這題考滿多次的,可是就是沒有很了解怎麼解這題... 可以請高手詳細說明一下嗎?(尤其是(b)小題) 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.39.13.219 ※ 編輯: boy5548 來自: 114.39.13.219 (01/28 13:29)
cakeboy:io bound 每做1 time unit 就會一次context switch so 01/28 20:09
cakeboy:10個IO bound 10*1.1=11 cpu bound 剛好10 time unit 01/28 20:11
cakeboy:做完也要一次context switch so 10+0.1=10.1 所以 實際用 01/28 20:12
cakeboy:在execute 的時間/總時間 20/21.1 成立 01/28 20:12
boy5548:請問為什麼cpu bound要做10 time unit? 01/28 23:26
boy5548:而且為什麼剛好10 time unit做完也要一次context-switch? 01/28 23:27
dy957:因為time quantum 是10 01/28 23:34
cakeboy:因為他寫 long-time 表示這些行程一直在跑 01/29 19:26
aoqq12:有個更簡單的想法你試試。。你就畫個 ready queue 01/29 23:27
aoqq12:然後cpu bound一開始就在裡面 你每隔1m就抓一個i/o bound 01/29 23:28
aoqq12:放進去ready queue 01/29 23:28
aoqq12:在照順序去給他cpu就好了 01/29 23:29
sneak: 在execute 的時 https://daxiv.com 09/11 14:11