[理工] [OS]99中山資工

看板Grad-ProbAsk作者 (好崩潰)時間14年前 (2012/01/17 15:33), 編輯推噓1(107)
留言8則, 1人參與, 最新討論串1/2 (看更多)
(1) [CPU Scheduling] 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 milliseconds to complete. Also assume that the context switching overhead is 0.1 milliseconds and that all processes are long-running tasks. What is the CPU utilization for a Round-robin scheduler when: (a) The time quantum is 1 millisecond (5%) (b) The time quantum is 10 milliseconds (5%) 這是恐龍本後面的練習題 我也看了解答了 可是我還是看不懂為什麼 答案是 (a)1/1.1*100=91% (b)20/21.1*100=94% -------------------------------------------------------------------------------- (2) [File-System Implermentation] Consider a file system on a disk that has both logical and physical block sizes of 512 bytes. Assume that the information about each file is already in memory. For each of the three allocation strategies (contiguous, linked, and indexed). answer these questions: (a) How is the logical-to-physical address mapping accomplished in this system? (For the indexed allocation, assume that a file is always less than 512 blocks long.) (b) If we are currently at logical block 10 (the last block accessed was block 10) and want to access logical block 4, how many physical blocks must be read from the disk? 這題我看到板上有蠻多人問的 可是好像都沒有很多人回應 所以我想在po問一次 而且我看恐龍解答也寫得很簡易 所以也是看不太懂 以上兩題希望大家可以慷慨解囊一下 鋼溫!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 223.143.134.206

01/18 00:58, , 1F
2)你可以想成 index block就像 VM的page table
01/18 00:58, 1F

01/18 00:59, , 2F
先將logical address除512 因為他1個block是512bytes
01/18 00:59, 2F

01/18 01:00, , 3F
商數就是locgical block number餘數就是 offset
01/18 01:00, 3F

01/18 01:00, , 4F
你再去index block查對應的pyhsical block在哪
01/18 01:00, 4F

01/18 01:01, , 5F
加上offset 不就是真實的位址
01/18 01:01, 5F

01/18 01:02, , 6F
再來他要先讀index block在讀 data block
01/18 01:02, 6F

01/18 01:02, , 7F
故要2次read
01/18 01:02, 7F

01/18 01:03, , 8F
這跟 VM 裡logical 轉physical address是一樣的概念
01/18 01:03, 8F
文章代碼(AID): #1F5IHWhq (Grad-ProbAsk)
文章代碼(AID): #1F5IHWhq (Grad-ProbAsk)