Jazan University, Jazan KSA Chapter 4 Lecture 10 Faheem Lecturer, CNET Dept., Jazan University, Jazan KSA Cache Memory
Cache Memory Mapping Memory Mapping means, making connection or link between main memory with the cache memory. Because there are fewer cache lines than main memory blocks, an algorithm is needed for mapping main memory blocks into cache lines. Further, a means is needed for determining which main memory block currently occupies a cache line. The choice of the mapping function dictates how the cache is organized. There are two techniques used in memory mapping, direct and associative. Book Page No 124
Direct Mapping In direct mapping Each block of main memory maps into one unique line of the cache. The above concept is clear from the diagram below. Book Page No 126 Direct Mapping
Associated mapping The second type of mapping is associated mapping. In associated mapping each block of main memory is associated to all line of cache memory. The above concept is clear from the diagram below. Book Page No 126 Associated Mapping
Replacement algorithms Once the cache has been filled, when a new block is brought into the cache, one of the existing blocks must be replaced. For direct mapping, there is only one possible line for any particular block, and no choice is possible. For the associative techniques, a replacement algorithm is needed. Book Page No 136
FIFO example First In First Out
LRU Least recently Used
Replacement algorithms There are three replacement algorithm, MRU, LRU and FIFO, that is Most recently used algorithm Least recently used algorithm First in first out In direct mapping there is no choice, as each block only maps to one line so replace that line. Book Page No 136
Thank you!!! Chapter 4 Ends!!!