Final answer:
The number of disk accesses to fetch the 5th block of a file is 1 for contiguous allocation, 5 for linked-list allocation, and 2 for indexed allocation. These numbers are based on how each method stores and accesses the file's blocks on the disk.
Step-by-step explanation:
The number of disk accesses required to fetch the 5th block of a file depends on the type of allocation method used to store the file on the disk. Here's how each method affects the number of accesses:
Contiguous Allocation:
Number: 1
Why: In contiguous allocation, all blocks of a file are stored together on the disk. To access the 5th block, the system simply calculates the start address of the file and then directly accesses the 5th block from the start without additional disk accesses.
Linked-list Allocation:
Number: 5
Why: With linked-list allocation, each block of the file contains a pointer to the next block. Therefore, to access the 5th block, the system needs to read each block starting from the first one to follow the chain of pointers—resulting in 5 disk accesses (one for each block along the path).
Indexed Allocation:
Number: 2
Why: In indexed allocation, all pointers to the blocks of a file are stored in a separate index block. To access the 5th block, the system first reads the index block (one disk access), and then directly accesses the 5th block using the pointer from the index (second disk access).