View worked solution
Answer: 153
To find the total number of disk accesses, we calculate the disk reads and writes required for both allocation strategies.
1. Contiguous Allocation ():
- The file has blocks. Inserting a new block between the and block means the new block becomes the block.
- The existing blocks from to (a total of blocks) must be shifted one position to the right.
- Shifting these blocks requires reading them from disk and writing them back to their new locations:
- We then write the new block (which is already in memory) to the disk at the position:
- Thus, .
2. Linked Allocation ():
- To insert a block after the block, we must traverse the linked chain from the start to locate the block.
- This requires reading blocks through :
- The pointer of the block (which points to the block) is copied to the new block's pointer in memory.
- We write the new block to disk:
- We update the block's pointer to point to the new block and write it back to disk:
- Thus, .
Total Disk Accesses:
Free practice · Your answers on this page are not saved.
