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?
- A. 262401
- B. 262147
- C. 262400
- 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
- Eight disks can be arranged as RAID 1+0 (4 mirrored pairs, striped together) or as RAID 0+1 (two 4-disk stripe sets, the second mirroring…
- Assume every fork() succeeds (it returns a non-zero value in the parent and 0 in the child) and each process prints X once when it reaches…
- Assume every fork() succeeds and output is unbuffered. int main(void) { int i; for (i = 0; i < 3; i++) { if (fork() == 0 && fork() == 0)…
- Banker's algorithm with two resource types (R1, R2). Allocation: P0 (0,2), P1 (1,4), P2 (0,4), P3 (6,1), P4 (0,2). Maximum: P0 (1,4), P1…
- Banker's algorithm, a single resource type, 6 processes P0..P5. Allocation: 1, 2, 2, 5, 3, 4. Maximum: 9, 3, 3, 7, 7, 9. Available = 1…
- The head is at cylinder 100 with pending requests 55, 58, 39, 18, 90, 160, 150, 38 and 184 (cylinders 0 to 199; no new requests arrive)…