看板 Grad-ProbAsk 關於我們 聯絡資訊
※ 引述《b76516 (阿聰)》之銘言: : 剛好先前有鄉民問到同一題引用一下 我想請問 linked 的(2)(3)(4) 為什麼是22.22.40 呢? 謝謝大家的指教 : 4. Consider a file consisting of 40 blocks. Assume that the file control block : (and the index block, in case of indexed allocation) is already in memory. : Calculate how many disk I/O operations are required for contiguous, linked, : and indexed(single-level) allocation strategies, if, for one block, the : following conditions hold. In the contiguous allocation case, assume that : there is no room to grow in the beginning, but there is room to grow in the : end. Assume that the block information to be added is stored in memory. : (1)The block is added at the beginning. : (2)The block is added in the middle. : (3)The block is removed from the middle. : (4)The block is removed from the end. : 答案寫說 : contiguous linked indexed : (1) 81 1 1 : (2) 41 22 1 : (3) 38 22 0 : (4) 0 40 0 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.41.112.218
lightergogo:(2)read:20(讀到第20個data) write:2(改變2次指標) 03/02 20:47
bigrat2:在請問一下 連續的(3)為什麼是38不是40呢? 03/02 22:46
lightergogo:從第22個block開始 往前搬一格 每次都要read&write 03/02 23:02
lightergogo:搬了(40-22+1)=19 次 所以19*2=38 03/02 23:03