CS FundamentalsVery hardGATE CS (PYQ pattern)
The clock (second-chance) algorithm manages 4 frames, initially empty and filled in order 0..3. A page's reference bit is set to 1 when it is loaded and on every hit. On a fault the hand sweeps forward, clearing set bits, and replaces the first frame with bit 0, then moves one step past it. How many page faults occur for the string 4, 3, 4, 5, 2, 5, 2, 6, 3, 4, 1, 6, 1, 4, 6, 3, 4, 5, 1, 6?
- A. 11
- B. 9
- C. 10
- D. 7
Correct answer: B. 9
Simulating the hand: clock gives 9 faults, whereas LRU gives 11, FIFO 10 and OPT 7 for the same string.
More Operating Systems questions
- Assume every fork() succeeds and each printf output is flushed immediately. int main(void) { for (int i = 0; i < 4; i++) { if (fork() ==…
- A Unix-style file system has 1 KB blocks, 4-byte block pointers and inodes with 12 direct, one single-indirect and one double-indirect…
- Holes in memory (in KB, in address order): 250, 240, 230, 180, 140. Processes arrive and stay resident in this order: 100, 190, 200, 150…
- A disk delivers 20 MB/s (1 MB = 10^6 bytes) to memory by DMA, 4 bytes per bus cycle. Each word transfer steals one 40 ns memory cycle from…
- Three threads each execute x = x + 1; twice on a shared int x that starts at 0 (so six increments in all). Each increment is a separate…
- A process has a 1 MB address space split into 4 segments, each paged separately; the single-level page tables together need one 8-byte…