CS FundamentalsHardGATE CS (PYQ pattern)

An inode has 12 direct pointers, one single-, one double- and one triple-indirect pointer; blocks are 2048 bytes and pointers are 4 bytes. With nothing cached (the inode itself is in memory), how many disk reads are needed to read one byte at each of the offsets 10,000, 24,575, 24,576 and 1,000,000 in turn?

  1. A. 6
  2. B. 5
  3. C. 7
  4. D. 8

Correct answer: A. 6

Block numbers are 4, 11, 12 and 488. Direct blocks (0 to 11) need 1 read; blocks 12 to 523 use the single-indirect block (2 reads); blocks up to 12 + 512 + 512^2 use the double-indirect tree (3 reads). Reads: [1, 1, 2, 2] = 6.

More Operating Systems questions

Exams that ask this topic