Consider an XML file containing student records implemented on a magnetic disk.
ID: 3799627 • Letter: C
Question
Consider an XML file containing student records implemented on a magnetic disk. The file has 10 blocks, numbered 0 to 9. Each block contains 100 student records. These logical records are numbered sequentially (starting from 0). Assume that each block x is stored on cylinder x. In addition, the directory is already loaded to main memory. An application program is unaware of the block-to-cylinder mapping. Answer questions 6 to 10 about this file.
The file is stored on disk using linked allocation. The 10 blocks of the file are linked in the order: 0 -> 1 -> 2 -> … -> 9.
How many disk seeks (cylinders) are required in order to read student record 518? The disk head starts at position p
The answer is 5 + p but I am not sure why? Any pointers will be helpful!
Explanation / Answer
No, 5+p is not correct. Because current position might be anything in the range of 0 - max. cylinders.
So 1->2->3->4->5, will definately take 4 seeks.
Other seeks will depends on the disk scheduling algorithm we are using:
1) if it is FIRST COME FIRST SERVE or SHORTEST SEEK TIME FIRST or SCAN algorithm:
It will take 4+p-1 seeks
2) If is C-SCAN algorithm:
it will take (max cylinder - p)+4