CS FundamentalsVery hardGATE CS

A file uses an inode with 12 direct pointers, then single-, double- and triple-indirect pointers; blocks are 4 KB with 4-byte pointers. The inode is already in memory but no other block is cached. How many disk reads are needed to read the single byte at offset 5 MB into the file?

  1. A. 3
  2. B. 2
  3. C. 4
  4. D. 1

Correct answer: A. 3

Direct blocks cover 48 KB and single-indirect another 1024 × 4 KB = 4 MB (up to 4 MB + 48 KB). Offset 5 MB lies in the double-indirect range: read the double-indirect block, then a single-indirect block, then the data block: 3 reads.

More Operating Systems questions

Exams that ask this topic