Hacker News new | ask | show | jobs
by rix0r 898 days ago
There seems to be a mistake in the animation.

> On a cache miss, SIEVE checks the object pointed to by the hand. If the object has been visited, its visited bit is reset

When the animation gets to the point where the I element is checked against the cache, the hand moves off of D without resetting its visited bit.

1 comments

Yes, the illustration is incorrect, and does not match the code's evict function, which only moves the hand after marking the current object "unvisited".

From the initial state, with the hand pointing to A(visited), when the request for H comes in, A is marked unvisited before moving the hand.

When the hand is pointing to D(visited) and the request for I comes in, it should mark D unvisited before moving the hand. This "feels wrong" because D had just barely been marked visited, but it is an implication of the SIEVE algorithm.

It's generally a red flag when a "better, simpler" algorithm is explained with a faulty illustration, suggesting the author overlooked or misunderstood the implications of the algorithm.

Thanks for pointing out. We have updated the animation.