DSA Factory
Free Virtual memory lessonsVirtual memory · Stage 1 · Page replacement · Step 3

Approximating LRU: the clock algorithm

Use one reference bit per page and a sweeping hand to get most of LRU's benefit at almost no cost. About 13 minutes.

Quick check

In the clock algorithm, the hand points at a page whose reference bit is 1. What happens?

  1. AThe bit is cleared and the hand moves on: the page gets a second chance
  2. BThe page is evicted
  3. CThe page is kept for ever
Show the answer

The bit is cleared and the hand moves on: the page gets a second chance. It has been used recently, so it isn't evicted yet.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve