US 7,469,320 B2
Adaptive replacement cache
Jeffrey S. Bonwick, Los Altos, Calif. (US); William H. Moore, Fremont, Calif. (US); Mark J. Maybee, Boulder, Colo. (US); and Matthew A. Ahrens, San Francisco, Calif. (US)
Assigned to Sun Microsystems, Inc., Santa Clara, Calif. (US)
Filed on May 03, 2006, as Appl. No. 11/417,078.
Claims priority of provisional application 60/733403, filed on Nov. 04, 2005.
Prior Publication US 2007/0106846 A1, May 10, 2007
Int. Cl. G06F 12/00 (2006.01)
U.S. Cl. 711—133 9 Claims
OG exemplary drawing
 
1. A method for caching a block, comprising:
receiving a request to store the block in a cache, wherein the cache is structured to comprise a most recently used (MRU) portion and a most frequently used (MFU) portion, wherein the MRU portion comprises a first evictable list and a first non-evictable list, and the MFU portion comprises a second evictable list and a second non-evictable list, wherein the first and second evictable lists are linked lists that store blocks that have no active references and the first and second non-evictable lists are linked lists that store blocks that have at least one active reference;
determining whether the cache is able to expand;
if the cache is able to expand:
expanding the cache at runtime to obtain an expanded cache, wherein expanding the cache comprises increasing the size of the cache, and
storing the block in the expanded cache;
if the cache is not able to expand:
determining whether evictable blocks are present in the cache;
if evictable blocks are present in the cache:
determining whether a total size of the evictable blocks is greater than or equal to a size of the block;
evicting a sufficient number of the evictable blocks from the cache and storing the block in the cache, if the total size of the evictable blocks is greater than or equal to the size of the block; and
activating a cache throttle, if the total size of the evictable blocks is less than the size of the block.