In: Other
For each of the three disk block allocation strategies (contiguous, linked, and indexed), if we are currently at logical block 12 (the last block accessed was block 12) and want to access logical block 5, how many physical blocks must be read from the disk? Assume that the information about each file is already in memory. Block Size = 512
Answer:---------
For Contiguous Allocation Stragegies ===> Physical
Blocks Read: 1
Contiguous Allocation Stragegies requires that each file occupy a
set of contiguous blocks on the disk. Disk addresses define a
linear ordering on the disk.
It can move from 12 to 5 with 1 read.
Note:--- For any type of access, contiguous allocation
requires only one access to get a disk block. Since we can easily
keep the initial address of the file in memory, we can calculate
immediately the disk address of the ith block (or the
next block) and read it directly.
For Linked Allocation Stragegies
===> Physical Blocks Read: 7
For direct access, however, an access to the ith block might
require i disk reads. This problem indicates why linked allocation
should not be used for an application requiring direct access."
The last block was logical block 12, to move back to block 5 (assuming the same file, and doubly linked list), it would take at most 7 reads. Logical read of pointer to previous block from 12, same for 11,10,9,8,7,6 , and finally it would be at block 5.
For Indexed Allocation Stragegies ===> Physical
Blocks Read: 1
If the index block is already in memory, then the access can be
made directly.
Given the information that it is in memory, then only 1 block read
is needed since the index table is loaded into memory.