Consider a file currently consisting of 50 blocks. Assume that the file…
2016
Consider a file currently consisting of 50 blocks. Assume that the file control block and the index block is already in memory. If a block is added at the end (and the block information to be added is stored in memory), then how many disk I/O operations are required for indexed (single-level) allocation strategy ?
- A.
1
- B.
101
- C.
27
- D.
0
Attempted by 194 students.
Show answer & explanation
Correct answer: A
Final answer: 1 disk I/O
Reasoning: Only the new data block must be written to disk. The file control block and the index block are already in memory, so there is no need to read them from disk. The index can be updated in memory.
Step 1: Allocate a free block and write the new data block to disk — this is one disk write.
Step 2: Update the index block in memory. Because the index block is already in memory, no additional disk read is needed; under the problem assumptions no immediate write of the index block to disk is counted.
Note: If the scenario required writing the updated index block back to disk immediately to make the change permanent, that would add one more disk write (total 2). The given answer of 1 follows the stated assumptions that the index block is already in memory and its in-memory update is sufficient.
A video solution is available for this question — log in and enroll to watch it.