Page replacement algorithm - LRU
algorithm
Solution
LRU stands for "Least Recently Used". It's based on taking advantage of "temporal locality" of reference, i.e. the thought that the same stuff will be used in a period of time.
In your case, the past three accesses before the current one were 0 - 4 - 2. This means that of the pages in physical memory, 0 was the least recently used, and so it gets paged out.
Problem
I am trying to teach myself LRU algorithm using this youtube video. In the below example (taken from here) why is 0 replaced by 3. Shouldn't that be 4 replaced by 3 as 4 is the least used ?