作者gensim (...)
看板Grad-ProbAsk
標題Re: [理工] [OS]-Allocation method
時間Sun Oct 11 16:12:11 2009
※ 引述《yesa315 (XD)》之銘言:
: Consider a file currently consisting of 100-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 IO 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 to be added is stored
: in memory.
: a. The block is added at the beginning.
: b. The block is added in the middle.
: c. The block is removed from the beginning.
: d. The block is removed from the beginning.
: e. The block is removed from the middle.
: f. The block is removed from the end.
: 答案是這樣:
: Contiguous Linked Indexed
: a 201 1 1
: b 101 52 1
: c 1 3 1
: d 198 1 0
: e 98 52 0
: f 0 100 0
: linked 跟 index 不太懂為什麼
: 可以請高手指導嗎 謝謝!
Linked
a.write new block to first block.
b.read first 50 blocks, modify the point of 50th blok, write new block to
first block.
c.read the last block(using the point of end block), and then modify it, write
new block to first block.
d.read the first block and copy its point to the point of beginning(coping is
in memory).
c.read the first 51 block and copy the point of 51th to the point of 50th.
d.read the first 99 block and copy the point of end to the point of 99th.
Indexed
a~c. write the new block to disk, and update indexed in memory.
d~f. update indexed in memory.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.40.9.145
1F:→ yesa315:瞭解了 謝謝! 10/11 17:35