225k views
4 votes
Consider a file whose data is spread over 1000 physical disk blocks on the disk. Assume the size of a logical block is equal to the size of a physical block. given a logical block number x, what is the maximum number of disk accesses that you would need to retrieve the physical block that corresponds to x? assume the file control block of f and the directory entry that contains information about f are cached in the main memory.

User Swbandit
by
7.2k points

1 Answer

4 votes

Final answer:

With the file control block and directory entry for the file cached in main memory, retrieving a physical block corresponding to a logical block number x from a disk requires a maximum of one disk access

Step-by-step explanation:

If the file control block (FCB) and the directory entry are cached in main memory, finding the physical block corresponding to a logical block number x requires accessing the block directly on disk since there is no additional metadata to retrieve from memory.

Since direct access storage devices such as hard disk drives can access a given block directly, the maximum number of disk accesses required to retrieve any physical block is one. This is due to the fact that the logical block number directly maps to the physical location in a 1:1 correspondence when the size of the logical block equals the size of the physical block.

On the other hand, if a linked allocation method is used, each logical block contains a pointer to the next logical block. In this case, multiple disk accesses are needed to traverse the linked list and retrieve the desired physical block.

For example, if the linked list needs to be traversed through 10 logical blocks, a maximum of 10 disk accesses would be required to retrieve the physical block corresponding to a given logical block number x.

User Benevolentprof
by
7.1k points