CS FundamentalsHardGATE CS (PYQ pattern)

A Unix file system uses 4 KB blocks, 4-byte pointers and inodes with 12 direct pointers, one single-, one double- and one triple-indirect pointer. How many disk blocks (data plus index blocks, excluding the inode) are needed to store a file of exactly 1 GiB?

  1. A. 262401
  2. B. 262147
  3. C. 262400
  4. D. 262402

Correct answer: A. 262401

Data blocks = 2^30 / 2^12 = 262,144. 12 are direct and 1,024 are reached through the single-indirect block, leaving 261,108 that need the double-indirect tree: 1 top block + ceil(261,108 / 1024) = 255 second-level blocks. Index blocks = 1 (single) + 1 + 255 = 257, total 262401.

More Operating Systems questions

Exams that ask this topic