CS FundamentalsVery hardGATE CS (PYQ pattern)
The clock algorithm uses 3 frames (initially empty); the reference bit is set when a page is loaded and on every hit. On a fault the hand examines frames one by one (clearing a set bit and moving on, or replacing a frame with a clear bit and then moving past it); every examined frame counts as one hand step, including the replaced one. String: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5, 3, 4, 6, 1. How many hand steps occur in total?
- A. 11
- B. 23
- C. 26
- D. 20
Correct answer: B. 23
There are 11 faults; each needs a sweep that clears the bits it passes before finding a victim, giving 23 examined frames in all.
More Operating Systems questions
- A counting semaphore S starts at 3 and is implemented so that wait() decrements S and blocks the caller if S becomes negative, while…
- A 16-core machine must unmap a page that all cores have in their TLBs. The initiating core sends an inter-processor interrupt to each of…
- Two periodic tasks with deadline = period and zero release offset: T1 (C=2, P=5) and T2 (C=4, P=7). Total utilisation is 2/5 + 4/7 ≈…
- Three periodic tasks (deadline = period, all released at t=0) are scheduled by preemptive rate-monotonic scheduling: T1 (C=2, P=5), T2…
- Two processes use shared variables flag[2] (initially 0) and turn. Process i (j = 1−i) runs: V1: flag[i]=1; turn=j; while(flag[j] &&…
- Binary semaphore m is initialised to 1. P1: P(m); print A; V(m); print B. P2: P(m); print C; V(m); print D. P3: P(m); print E; V(m). All…