CS FundamentalsVery hardProduct company interview · GATE level
A Unix-style inode has 12 direct pointers plus single-, double- and triple-indirect pointers; blocks are 4 KB and pointers 4 bytes. With the inode already in memory and no other blocks cached, a process reads the byte at offset 50,000,000 of a large file. Through which pointer is it reached, and how many disk blocks must be read?
- A. The double-indirect pointer (entry 11, then entry 943); 3 block reads
- B. The single-indirect pointer; 2 block reads
- C. The double-indirect pointer (entry 10, then entry 931); 3 block reads
- D. The triple-indirect pointer; 4 block reads
Correct answer: C. The double-indirect pointer (entry 10, then entry 931); 3 block reads
Logical block = floor(50,000,000 / 4096) = 12,207. A block holds 1024 pointers, so blocks 0-11 are direct and 12-1035 are single-indirect. 12,207 is beyond 1035, so it is reached through the double-indirect pointer, at relative block 12,207 - 1036 = 11,171 = 10 x 1024 + 931. Reads: the double-indirect block, the single-indirect block found at its entry 10, then the data block at entry 931 of that one - 3 reads. Dividing by 4000 instead of 4096 or forgetting to subtract the 1036 earlier blocks gives the wrong entries.
More Operating Systems questions
- Each process in a system spends 70% of its time waiting for I/O, independently of the others. Using the model CPU utilisation = 1 - p^n…
- Round Robin is used with a quantum of 4 ms and a context-switch time of 1 ms. There are always 10 CPU-bound processes ready and none does…
- A TLB has 64 entries. With 4 KB pages, what is its reach (the memory it can map without a miss)? If 16 of the entries instead map 2 MB…
- Processes (arrival, burst) in ms: P1 (0, 10), P2 (1, 6), P3 (3, 2), P4 (5, 4), P5 (6, 1). Under preemptive SJF (SRTF), what is the average…
- Processes (arrival, burst) in ms: A (2, 6), B (3, 2), C (4, 1), D (12, 3), E (13, 2). The CPU is idle until the first arrival. Under…
- Round Robin, quantum 3 ms. Processes (arrival, burst): P1 (0, 7), P2 (1, 5), P3 (2, 3), P4 (4, 6). A process arriving at the same instant…