Caching Algorithm

From GM-RKB
(Redirected from Cache Algorithm)
Jump to navigation Jump to search

A Caching Algorithm is an algorithm that manages a cache data structure (to solve a caching task).



References

2013

  • http://en.wikipedia.org/wiki/Cache_algorithms#Overview
    • The average memory reference time is [math]\displaystyle{ T = m*T_m + T_h + E }[/math] where
      • [math]\displaystyle{ T }[/math] = average memory reference time
      • [math]\displaystyle{ m }[/math] = miss ratio = 1 - (hit ratio)
      • [math]\displaystyle{ T_m }[/math] = time to make a main memory access when there is a miss (or, with multi-level cache, average memory reference time for the next-lower cache)
      • [math]\displaystyle{ T_h }[/math]= the latency: the time to reference the cache when there is a hit
      • [math]\displaystyle{ E }[/math] = various secondary effects, such as queuing effects in multiprocessor systems
    • There are two primary figures of merit of a cache: The latency, and the hit rate. There are also a number of secondary factors affecting cache performance.[1]

      The "hit ratio" of a cache describes how often a searched-for item is actually found in the cache. More efficient replacement policies keep track of more usage information in order to improve the hit rate (for a given cache size).

      The "latency" of a cache describes how long after requesting a desired item the cache can return that item (when there is a hit).

      Faster replacement strategies typically keep track of less usage information — or, in the case of direct-mapped cache, no information — to reduce the amount of time required to update that information.

      Each replacement strategy is a compromise between hit rate and latency.

      Measurements of "the hit ratio" are typically performed on benchmark applications. The actual hit ratio varies widely from one application to another. In particular, video and audio streaming applications often have a hit ratio close to zero, because each bit of data in the stream is read once for the first time (a compulsory miss), used, and then never read or written again. Even worse, many cache algorithms (in particular, LRU) allow this streaming data to fill the cache, pushing out of the cache information that will be used again soon (cache pollution). [2]

  1. Alan Jay Smith. “Design of CPU Cache Memories". Proceedings of IEEE TENCON, 1987. [1]
  2. Paul V. Bolotoff. "Functional Principles of Cache Memory". 2007.