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?
- A. 6
- B. 5
- C. 7
- 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
- A parent creates a pipe, forks, and the child loops on read(fd[0], buf, 1) until it returns 0. The parent writes 3 bytes into fd[1] and…
- A system uses segmentation with paging (1024-byte pages). Segment table: seg 0: limit 3000, page frames [7, 2, 9]; seg 1: limit 1500…
- A process on a 4-level, 48-bit paging system (9 index bits per level, 4 KB pages, 4 KB page-table pages) maps three regions: 2 MB at…
- On a 4-level x86-64 style paging system (4 KB table pages, 512 eight-byte entries each, 2 MB pages are leaves at the third level), a…
- Polling a device costs a fixed 10% of the CPU (100,000 polls/s at 1 microsecond each) plus 0.5 microseconds of handling per event…
- In Lamport's bakery algorithm five processes P0 to P4 hold tickets (number, id): P0 has 4, P1 has 3, P2 has 4, P3 is not competing (0) and…