CS FundamentalsHardGATE CS (PYQ pattern)

The aging algorithm keeps an 8-bit counter per page (initially 0). At every clock tick each counter is shifted right by one bit and the page's reference bit for that tick is put into the leftmost bit. Reference bits over five ticks (tick 1 first) are page 0: 10110, page 1: 01101, page 2: 11010, page 3: 00111, page 4: 10011. After tick 5, which page has the smallest counter and is evicted?

  1. A. page 3
  2. B. page 1
  3. C. page 2
  4. D. page 4

Correct answer: C. page 2

After 5 ticks the counter holds tick 5 in bit 7, tick 4 in bit 6, ... tick 1 in bit 3. Counters: page 0 = 01101000, page 1 = 10110000, page 2 = 01011000, page 3 = 11100000, page 4 = 11001000. Page 2 is smallest. Reading the strings as binary with tick 1 most significant picks page 3 wrongly; counting references only cannot separate the pages.

More Operating Systems questions

Exams that ask this topic