# What's the difference between clock replacement & LRU replacement?

As title. When we want to request following page numbers 2,4,4,2,5,2,1,1,3,1, is clock replacement better? What are the advantages and disadvantages of them?

Thanks~

• This would depend on the number of page frames there are. – Rick Decker Feb 26 '16 at 1:39
• @Rick Decker Thanks for helping with that. If the buffer pool with 3 pages and the requests are above. What's the difference between them? – Echo0831 Feb 26 '16 at 3:13
• What are your thoughts? What research have you done? We expect you to do a significant amount of research and self-study before asking, and to show us in the question what you've tried and what your thoughts are. – D.W. Feb 26 '16 at 3:34

Every operating system text I have on my shelf includes a discussion on the relative performance of various page replacement algorithms, so there's where you'll find more extensive comparisons than would fit here. Some empirical studies show that in general there's reason to assert that MIN (a.k.a OPTIMAL) generates the fewest page faults (in fact, MIN is provably optimal), followed by LRU, CLOCK, and FIFO, in that order. In terms of implementation, MIN is, of course, impossible, since it requires knowledge of the future$^*$, LRU is somewhat difficult to do, basic CLOCK is fairly easy (and can be improved with relatively little effort), and FIFO is easiest.
$^*$ If I had a time machine, I certainly wouldn't waste my time including it in the hardware to support MIN. I'd buy lottery tickets and/or play the stock market.