CS FundamentalsHardGATE CS (PYQ pattern)

A file of 100,000 bytes is stored on a disk with 512-byte blocks. Under linked allocation each block holds a 4-byte next-pointer and 508 data bytes; under FAT allocation all 512 bytes are data and the whole FAT is already cached in memory. Starting from the directory entry (in memory), how many disk-block reads does each scheme need to fetch the byte at offset 60,000 (offsets start at 0)?

  1. A. linked 118, FAT 1
  2. B. linked 197, FAT 1
  3. C. linked 119, FAT 118
  4. D. linked 119, FAT 1

Correct answer: D. linked 119, FAT 1

Linked: offset 60,000 lies in block index 60000 / 508 = 118 (0-based), and every block 0..118 must be read to follow the pointers: 119 reads. FAT: the chain is walked in the cached table, so only the data block (index 60000 / 512 = 117) is read: 1 read. Using 512 data bytes per linked block (or forgetting the target block) gives 118; 197 is the whole file; FAT 118 ignores that the FAT is cached.

More Operating Systems questions

Exams that ask this topic