CS FundamentalsVery hardGATE CS (PYQ pattern)
NRU replacement runs with 3 frames (initially empty). Each page has bits (R, M): R is set on every reference, M on every write, and a newly loaded page starts at (0, 0) before its reference is applied. After every 4th reference (after references 4, 8, 12, ...) the OS clears R of all resident pages. On a fault with no free frame the victim comes from the lowest non-empty class (0,0) < (0,1) < (1,0) < (1,1), ties going to the lowest-numbered frame; frames are filled 0, 1, 2. A dirty victim must be written back. References (R = read, W = write): 1R 2W 3R 1W 4R 2R 5W 1R 3W 2R 4W 5R 1R 3R. How many page faults and write-backs occur?
- A. 10 faults, 3 write-backs
- B. 9 faults, 3 write-backs
- C. 10 faults, 5 write-backs
- D. 11 faults, 3 write-backs
Correct answer: A. 10 faults, 3 write-backs
Faults at refs 1, 2, 3, then 4R evicts 3 (class (0,0) after the clear), 5W evicts dirty 1 (class (0,1)), 1R evicts 4 (class (1,0)), 3W evicts 1 (clean), 4W evicts dirty 5, 5R evicts dirty 4, 1R evicts clean 5 after the clear at 12. That is 10 faults and 3 write-backs (pages 2 and 3, still dirty at the end, are not counted). Never clearing R gives 9 faults.
More Operating Systems questions
- Round Robin runs 10 always-runnable, CPU-bound processes; every context switch costs 0.5 ms and each process always uses its full quantum…
- Six processes share identical units of one resource; each needs at most 4 units. Five of them request units one at a time, holding what…
- The disk has cylinders 0 to 199. The head is at 100, moving towards higher cylinders. Pending requests: 23, 89, 132, 42, 187, 70, 12. SCAN…
- With 3 frames (initially empty) the reference string is 2, 5, 3, 6, 2, 5, 4, 2, 4, 2, 1, 2, 5, 6, 6, 1, 2, 3, 6, 3, 4, 4. The clock…
- A file of 100,000 bytes is stored on a disk with 512-byte blocks. Under linked allocation each block holds a 4-byte next-pointer and 508…
- A 2^40-byte disk uses 4 KB blocks. Free space can be tracked either by a bitmap (1 bit per block) or by a plain list of free block…