Consider a file system on a disk that has both logical and physical block sizes
ID: 3776556 • Letter: C
Question
Consider a file system on a disk that has both logical and physical block sizes of 512 bytes. Assume that the information about each file is already in memory. For each of the three allocation strategies (contiguous, linked, and indexed), answer these questions :
How is the logical-to-physical address mapping accomplished in this system (for the indexed allocation, assume that a file is always less than 512 blocks long.)
If we are currently at logical block 10 (the last block accessed was block 10) and want to access logical block 4, how many physical blocks must be read from the disk?
Explanation / Answer
a) Answer:
Let C be the starting file address (block number)
Contiguous : Divide the logical address by 512 with A and B the resulting quotient and remainder . Add A to C to obtain the physical block number. B is the displacement into that block.
Linked : Divide the logical physical address by 511 with A and B the resulting quotient and remainder . To chase down the linked list (getting A+1 blocks) , B+1 is the displacement into the last physical block.
Indexed: Divide the logical address by 512 with A and B the resulting quotient and remainder. To get the index block into memory , physical block address is contained in the index block at location A. B is the displacement into the for the desired physical block.
b)Answer:
I f we are currently at logical block 10 and want to access logical block 4, for that number of physical blocks must be read from the disk is :
For Contiguous , the number of physical blocks must be read from the disk is 1.
For Linked , the number of physical blocks must be read from the disk is 4.
For Indexed , the number of physical blocks must be read from the disk is 2.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.