Download presentation
Presentation is loading. Please wait.
Published byShavonne Robinson Modified over 9 years ago
1
A BRIEF INTRODUCTION TO CACHE LOCALITY YIN WEI DONG 14 SS
2
THINGS TO BE DISCUSSED Types of locality Algorithms to improve data locality History of locality reference Thrashing Applications
3
TEMPORAL LOCALITY If at one point in time a particular memory location is referenced, then it is likely that the same location will be referenced again in the near future. To make efforts to store a copy of the referenced data in special memory storage, which can be accessed faster.
4
SPATIAL LOCALITY If a particular memory location is referenced at a particular time, then it is likely that nearby memory locations will be referenced in the near future. To attempt to guess the size and shape of the area around the current reference for which it is worthwhile to prepare faster access.
5
BRANCH LOCALITY Few amount of possible alternatives in the critical path Not a spatial locality since few possibilities can be located far away from each other.
6
OVERVIEW Important factor: LATENCY HIT RATIO
7
EXAMPLE : LEAST RECENT USED Discards the least recently used items first expensive to always discards the least recently used item Implementation : keeping "age bits"
8
EXAMPLE : MOST RECENTLY USED Discards the most recently used items first. In contrast to LRU Better for random access patterns and repeated scans over large datasets
9
EXAMPLE : RANDOM REPLACEMENT(RR) Randomly selects a candidate item and discards it to make space when necessary Used in ARM processors for its simplicity
10
OPTIMAL SOLUTION IN THEORY The most efficient caching algorithm would be to always discard the information that will not be needed for the longest time in the future. Not implementable in practice because it is impossible to predict. Used to compare the effectiveness of the actually chosen cache algorithm with the optimal solution after experimentation.
11
CACHE-OBLIVIOUS ALGORITHM designed to take advantage of a CPU cache without having the size of the caches as a parameter. Good performance on multiple machines with different cache sizes without modification Works by a recursive divide and conquer algorithm
12
HISTORY OF LOCALITY REFERENCE Hints: The learning algorithm was controversial. It performed well on programs with well- defined loops and poorly on many other programs.
13
HISTORY OF LOCALITY REFERENCE WHYTHRASHING?
15
WHY THRASHING memory to disk : if the working set of a program or a workload cannot be effectively held within physical memory, then constant data swapping may occur CPU cache to memory : main memory is accessed in a pattern that leads to multiple main memory locations competing for the same cache lines, resulting in excessive cache misses and lack of performance
16
SOLUTIONS Increase the amount of RAM in the computer. Decrease the number of programs being run on the computer. Replace programs that are memory-heavy with equivalents that use less memory. Assign working priorities to programs, i.e. low, normal, high. Improve spatial locality
17
APPLICATIONS OF CACHE LOCALITY In Web browsers to hold recent Web pages. In search engines to find the most relevant responses to queries. In video boards to accelerate graphics displays In edge servers to hold recent Web pages accessed by anyone in an organization or geographical region The principle of cache locality will be useful wherever there is an advantage in reducing the apparent distance from a process to the objects it accesses The principle of cache locality will be useful wherever there is an advantage in reducing the apparent distance from a process to the objects it accesses
18
END
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.