CS FundamentalsHardGATE CS (PYQ pattern)
A Unix-like file system has 1 KB blocks, 4-byte pointers, and inodes with 10 direct pointers and one single-indirect pointer. Every directory fits in one block and all inodes are stored separately on disk. The root inode is in memory; nothing else is cached. A program opens /usr/lib/data.bin (exactly 100 blocks long) and reads the whole file sequentially. How many disk-block reads are needed for the path lookup plus reading the whole file (no read-ahead)?
- A. 106
- B. 108
- C. 110
- D. 107
Correct answer: D. 107
Path lookup: root directory block (1), inode of usr (1) + its directory block (1), inode of lib (1) + its directory block (1), inode of data.bin (1) = 6 reads. The file needs 100 data blocks plus 1 single-indirect block (blocks 10 to 99 are reached through it) = 101. Total 107.
More Operating Systems questions
- Banker's algorithm with 3 resource types. Allocation: P0 (1,0,0), P1 (1,2,0), P2 (0,0,0), P3 (1,4,3), P4 (3,1,1). Maximum: P0 (5,3,2), P1…
- Every fork() succeeds, wait() blocks until some child has terminated (it returns at once if the caller has no un-waited children), and…
- A buddy allocator manages 1024 KB (minimum block 16 KB, requests rounded up to powers of two; the lowest-addressed free block of the…
- A 128 KB physically-tagged, virtually-indexed L1 cache has 64-byte lines and is 16-way set-associative. The system uses 4 KB pages. How…
- A machine has 2 GB of RAM; the OS occupies 512 MB and every user process needs 192 MB, so as many whole processes as fit are kept in…
- Highest Response Ratio Next (non-preemptive; ratio = (waiting time + burst) / burst, evaluated whenever the CPU becomes free) schedules…