Question 3 (25 points): Consider a file currently consisting of 100 blocks. Assu
ID: 3717478 • Letter: Q
Question
Question 3 (25 points): 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 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 at the beginning but there is room to grow at the end. Also assume that the block information 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 added at the end. d. The block is removed from the beginning. e. The block is removed from the middle f. The block is removed from the end.Explanation / Answer
The below is the answer:
Continuous 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
The Justification of few of the above is below & the same can be applied to other options:
A: The Block is added at the beginning:
In case of Continuous Allocation method, we need 100 disk I/Os for reading the entire file into memory, 1 disk I/O for writing the new block to disk at the beginning of the file ( in the 1st block), and 100 disk I/O’s for writing the remaining 100 blocks of the file to disk starting from the 2nd block, and 1 disk I/O for writing the file control block to change the file length to 101. So overall 201.
In case of linked allocation method, we first find a free block in disk, and then we need one disk I/O for writing the new block with a pointer to the first block whose disk address can be found in the file control block to disk in the free block we have found.
In case of indexed allocation method, we first find a free block in disk, and then we need one disk I/O for writing the new block in the free block we have found. Then, we have to insert the disk address of the new block the 1st entry of the disk-block array in the index block.
C: The Block is added at the End:
In case of contiguous allocation method, we need to write the new block, resulting in 1 disk I/O.
In linked allocation method, we need to read last block update its link information and write back last
block and new block, which results in 3 disk I/O.
Where as in case of Indexed allocation method, we only need one write.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.