Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these describes the second-chance (clock) page replacement algorithm?

  • A.FIFO order, but a page with its reference bit set is spared and the bit cleared
  • B.Pages are replaced strictly at random
  • C.The largest page is always replaced first
  • D.Pages are replaced in reverse order of loading

Answer: D

Correct answer: FIFO order, but a page with its reference bit set is spared and the bit cleared

The second-chance algorithm is FIFO with one modification. When a page reaches the head of the queue, its reference bit is examined: if the bit is 0 the page is replaced, and if it is 1 the bit is cleared and the page is given another chance, moving to the back of the queue as though newly loaded. Implemented as a circular queue with a pointer sweeping round it, this is known as the clock algorithm, and the pointer is the clock hand. Its purpose is to approximate LRU at almost no cost. True LRU needs a timestamp or a stack updated on every memory reference, which is too expensive; the reference bit is set by hardware for free, and one bit is enough to distinguish pages used recently from pages not used at all. An enhanced version considers the dirty bit as well, preferring to evict pages that are both unreferenced and unmodified, since those need no write-back. Most real operating systems use some variant of it.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.