OS & Hardware

In the clock (second-chance) page-replacement algorithm, what is each page's reference bit used for?

  1. ATo identify recently used pages and approximate LRU eviction cheaply
  2. BTo check whether a page was modified and decide whether to write it back
  3. CTo count how many processes use a page and evict the most shared first
Show answer and explanation

Answer: A. To identify recently used pages and approximate LRU eviction cheaply

Exact LRU requires updating an order on every access, which is costly with many pages. In the clock algorithm, hardware sets a page's reference bit to 1 when it is accessed; the OS sweeps pages like a clock hand, clearing a 1 to 0 and passing over the page (a second chance), and evicting a page whose bit is already 0. This keeps recently used pages and approximates LRU cheaply. Whether to write a page back is decided by the dirty bit.

  • A. Correct. The reference bit identifies recent use for LRU-like replacement.
  • B. The dirty bit decides whether to write back.
  • C. It does not evict based on the number of processes.
Practice this topic Back to topic

More OS & Hardware questions

  1. With FIFO page replacement, adding physical pages can sometimes increase page faults. What is this phenomenon called?
  2. What is the state called in which physical memory is so short that pages are constantly evicted and reloaded and little work gets done?
  3. Memory access time is 100 ns and handling a page fault takes 8 ms. If a page fault occurs once per million accesses, what is the average access time approximately?
  4. During a context switch, what must be saved for the process being switched out?
  5. Why can a process context switch degrade performance more than the time spent saving and restoring registers would suggest?