CS FundamentalsVery hardGATE CS
The aging algorithm keeps an 8-bit counter per page; every tick it shifts the counter right by one and puts the page's reference bit into the leftmost bit, then clears the bit. Over 4 ticks page X's reference bits are 1, 0, 0, 1 and page Y's are 0, 1, 1, 0 (first tick first). Counters start at 0. Which page is evicted?
- A. X, because it was referenced fewer times
- B. Y, because it was referenced more times
- C. Y, because X's counter 10010000 is larger than Y's 01100000
- D. X, because its counter 10010000 is smaller
Correct answer: C. Y, because X's counter 10010000 is larger than Y's 01100000
After the four ticks the most recent tick is the leftmost bit: X = 1001 0000 (binary) = 144, Y = 0110 0000 = 96. The page with the smallest counter (least recently used, approximately) is the victim: Y.
More Operating Systems questions
- Which is a disadvantage of a very large page size (e.g. 1 GB pages for all memory)?
- Kernel same-page merging (KSM) / page deduplication scans for identical pages across VMs and maps them to one frame. What makes this safe…
- Writes of at most PIPEBUF bytes to a pipe have which guarantee when several writers share the pipe?
- A process reads a file sequentially, and the OS detects this. Which buffer-cache policy is most appropriate?
- Which statement about the unified buffer cache (page cache shared by mmap and read/write) is correct?
- A log-structured file system (LFS) writes all modifications sequentially to a log. What is its main background cost?