Suppose there are six files F1, F2, F3, F4, F5, F6 with corresponding sizes 150 KB, 225 KB, 75 KB, 60 KB, 275 KB and 65 KB respectively. The files are to be stored on a sequential device in such a way that optimizes (average) access time. In what order should the files be stored?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. F4, F6, F3, F1, F2, F5
Explanation
On a sequential (tape-like) device, reaching any file means physically passing over every file stored ahead of it, so the time to reach file k is proportional to the sum of the sizes of all files placed before it. If every file is accessed with roughly equal probability, the total access time is minimised by the classic 'shortest job first' scheduling rule: placing the smallest files first keeps the cumulative size small for as many of the subsequent files as possible. Sorting by increasing size gives F4 (60), F6 (65), F3 (75), F1 (150), F2 (225), F5 (275), i.e. F4, F6, F3, F1, F2, F5, option (ii); storing largest-first would instead maximise, not minimise, the average time to reach a typical file.More Database Management Systems questions
- Match the following for the UNIX file system: List I: (A) Boot block (B) Super block (C) Inode block (D) Data block List II: (I) Contains i…
- Which of the following statements about the UNIX file system is NOT correct?
- In UNIX, files are protected using a 9-bit permission mode ("rights bits"). Consider the statements: (I) A mode of 641 (octal) means the ow…
- A disk head is initially positioned at track 32. The disk I/O request queue, in arrival order, is: 98, 37, 14, 124, 65, 67. Using the FCFS…
- Consider the following three relations Employee(eid, eName), Comp(cid, cName), Own(eid, cid). Which of the following relational algebra exp…
- Consider R(A, B, C, D, E) be relation with following dependencies: C->F, E->A, EC->D, A->B. Which of the following is a key for R ?