作者dendrobium (石斛蘭)
看板Grad-ProbAsk
標題Re: [理工] [OS] I/O operation
時間Tue Mar 23 09:42:14 2010
※ 引述《flyguava (紅芭樂)》之銘言:
: Consider a file currently consisting of 200 blocks. Assume that the file
: control block (and the index block, in the 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. Assume
: that each disk I/O operation accesses only one block. In the contiguous
: allocation case, there is no room to grow in the beginning, but there is room
: to grow in the end. Moreover, the block information to be added is already
: stored in memory.
: (a). The block is added at the beginning.
contiguous : 200(讀) + 201(寫) = 401
linked : 1(寫) = 1
indexed : 1(寫) = 1
: (b). The block is added in the middle.
contiguous : 100(讀) + 101(寫) = 201
linked : 100(讀) + 2(寫) = 102
indexed : 1(寫) = 1
: (c). The block is added at the end.
contiguous : 1(寫) = 1
linked : 1(讀) + 2(寫) = 3
indexed : 1(寫) = 1
: (d).The block is removed from the beginning.
contiguous : 199(讀) + 199(寫) = 398
linked : 1(讀) = 1
indexed : 0 = 0
: (e).The block is removed from the middle.
contiguous : 100(讀) + 100(寫) = 200
linked : 101(讀) + 1(寫) = 102
indexed : 0 = 0
參考看看^^a
--
人家可不是為了你才這樣做的哦!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.198.35.85
推 flyguava:先謝謝^^ 但我想問e 小題 contiguoos 為何不是99+99? 03/23 09:50
→ flyguava:linked 不是100+1 呢? 謝謝 03/23 09:51
→ dendrobium:因為我想的middle 是第101個block (從1開始算XD 03/23 09:57
推 flyguava:恩恩 懂了 感恩^^ 03/23 09:59
推 fef92:請問(c)linked 為什麼只要讀1次就知道最後一個block在哪 03/23 11:41
→ dendrobium:因為physical directory有紀錄最後一個block的位置 03/23 11:58