News for hackers. Stuff that matters.
Re:Cache Eviction: When Are Randomized Algorithms Better Tha... by vesinisa on Monday February 18, 2019 @12:53AM (#19188880)
Interesting read, but I wish he'd explain how 2-random and LRU differ better. In a nutshell, LRU tracks the time when a cache item was last accessed and always discards the oldest item. 2-random also tracks the age of all cache items, but when discarding picks two random items and discards the oldest of those two.
Re:Cache Eviction: When Are Randomized Algorithms Better Tha... by wizeman on Monday February 18, 2019 @06:10AM (#19189929)
It doesn't discard the oldest item, it discards the item that was least recently used/accessed (LRU, like the name says). To see the difference more clearly, note that the oldest item can in fact be the most recently used one.