I'm talking about implementing an LRU memory page replacement algorithm in C, not in Java or C ++.
According to the course of OS notes :
OK, so how do we actually implement LRU? Idea 1): mark everything we touch with a timestamp. Whenever we need to carve a page, we select the oldest page (= the least recently used). Turns out this simple idea is not so good. What for? Since for each memory load we would have to read the contents of the clock and execute the memory! Therefore, it is clear that saving timestamps will cause the computer to be twice as slow. I
Loading and storing memory should be very fast. Do I need to get rid of these little tiny operations?
When replacing memory, the overhead of loading a page from disk should be much more significant than memory operations . Why do you really need to store memory and load memory?
If what is said in the notes is wrong, then what is the real problem with implementing a time-stamped LRU?
EDIT:
As I dig deeper, I can think of the following: These memory storage and load operations occur when a page hits. In this case, we do not load the page from the disks, so the comparison is not valid.
, , , LRU, . udpate , , .
, . . - ? !