Your computer keeps a small, fast cache in front of slow memory. It holds only k pages, but the program keeps asking for more pages than fit. Each request is either a hit (the page is already cached — instant) or a miss (fetch it from slow memory, and if the cache is full, evict something to make room).
The whole game is the eviction choice. Throw out a page the program never touches again and you lose nothing. Throw out the page it asks for next and you pay another expensive miss. The catch: you must decide now, with no idea what the program will request next.
That last word — next — is the heart of it. The clairvoyant who can see the future plays this perfectly. You cannot see the future. The surprising part is exactly how much that blindness costs you, and that it can be pinned down to the dot.
Comments
Loading comments...