![]() I guess if you just choose a line to evict, the handler can return without actually waiting for the cache miss itself to resolve, so you could possibly have it run again while another cache miss was still in flight. It would also hurt memory-level parallelism (multiple cache misses in flight at once) which is very important for hiding the large memory latency. looping over large arrays where most accesses miss in at least first level cache (if you aren't doing enough computation for HW prefetch to stay ahead). Some trigger a lot of cache replacement, e.g. Trapping to the OS on every cache miss would make cache misses much more costly. From this reasoning, we can see why dedicated logic gates are built right in to the same cache checking and update hardware. ![]() If we consider what it might look like for an OS to have a hand in managing the hardware caches, we quickly see how insane it would be just to implement at all (can the handler access memory? What if it needs to replace a line in a set?) And that performance would be a disaster, as well as implementation complexity. ![]() (True LRU takes too many bits for state, especially with 8-way or more associative.) See also - large slower caches (like 元 cache in modern Intel CPUs) may use an adaptive replacement policy to try to keep some valuable lines even when there are tons of cache misses from a huge working set that doesn't have much future value. Hardware caches manage their own replacement, typically with a pseudo-LRU approach to choosing which way of a set to evict. the "time when last used" information is stored in a "cache tag" along with other meta-data). Typically this means storing some kind of "time when last used" along with the data (for each item in the cache) which means (for performance) typically "least recently used" (and eviction itself) is built directly into the design of the cache (e.g. Ideally, "least likely to be needed soon" data should be evicted, but that's too hard determine so most caches make the (potentially incorrect) assumption that "least recently used" is a good predictor of "least likely to be needed soon". There are many types of caches where some are implemented by software (DNS cache, web page cache, file data cache) and some are implemented in hardware (instruction caches, data caches, translation look-aside buffers).įor all cases whenever new data needs to be inserted into the cache and there isn't enough space, other data needs to be evicted quickly to make space for the new data. Typically a cache manages cache replacement itself (its not done by a separate part). Which part of the computer manages cache replacement? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |