CS FundamentalsHardGATE CS
A clock (second-chance) algorithm has frames f0–f4 holding P3 (R = 1), P8 (R = 0), P5 (R = 1), P1 (R = 1) and P6 (R = 0). The hand points at f2. Two page faults happen in a row with no references in between; a newly loaded page gets R = 1 and the hand moves past it. Which pages are evicted?
- A. P8, then P6
- B. P6, then P8
- C. P6, then P3
- D. P8, then P3
Correct answer: B. P6, then P8
From f2: P5 and P1 have R = 1, so their bits are cleared; P6 at f4 has R = 0 and is evicted. The hand moves on to f0: P3's bit is cleared, and P8 at f1 (R = 0) is evicted. Scanning from f0 instead of the hand gives P8 first.
More Operating Systems questions
- A system has a TLB lookup of 20 ns, memory access of 100 ns, single-level paging and a TLB hit ratio of 90%, so a reference costs 130 ns…
- A 40-bit virtual address space uses 8 KB pages and 8-byte page-table entries, and every page-table node at every level must fit in exactly…
- Banker's algorithm, resources (A, B, C). Allocation / Max: P0 (1,0,1) / (4,3,2), P1 (2,1,0) / (3,2,2), P2 (0,1,1) / (2,3,3), P3 (1,1,0) /…
- Deadlock detection, resources (A, B, C), Available = (1, 0, 0). Allocation / Request: P1 (0,1,0) / (1,0,0), P2 (1,0,1) / (0,2,0), P3…
- Four processes need at most 3, 4, 5 and 2 units of one resource type and request them one at a time in any order. What is the smallest…
- Semaphores s = 0 and t = 0. P1: print A; signal(s); wait(t); print B. P2: wait(s); print C; signal(t); wait(s); print D. P3: print E…