Chapter 7
Cache Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Table 7.1 �Key Characteristics of Computer Memory System
Characteristics of Memory Systems
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Method of Accessing Units of Data
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Sequential access
Memory is organized into units of data called records
Access must be made in a specific linear sequence
Access time is variable
Direct access
Involves a shared read-write mechanism
Individual blocks or records have a unique address based on physical location
Access time is variable
Random access
Each addressable location in memory has a unique, physically wired-in addressing mechanism
The time to access a given location is independent of the sequence of prior accesses and is constant
Any location can be selected at random and directly addressed and accessed
Main memory and some cache systems are random access
Associative
A word is retrieved based on a portion of its contents rather than its address
Each location has its own addressing mechanism and retrieval time is constant independent of location or prior access patterns
Cache memories may employ associative access
Capacity and Performance:
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
The two most important characteristics of memory
Three performance parameters are used:
Access time (latency)
Memory cycle time
Transfer rate
Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Memory Hierarchy
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Table 4.2
Elements of Cache Design
Cache Addresses
Virtual Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Table 4.3 ��Cache Sizes of Some Processors
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
a Two values separated by a slash refer to instruction and data caches.
b Both caches are instruction only; no data caches.
(Table can be found on page 134 in the textbook.)
Mapping Function
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Direct
Associative
Set Associative
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Direct Mapping Summary
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Victim Cache
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Associative Mapping Summary
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Set Associative Mapping
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Set Associative Mapping Summary
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Replacement Algorithms
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
The most common replacement algorithms are:
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Write Policy
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
When a block that is resident in the cache is to be replaced there are two cases to consider:
If the old block in the cache has not been altered then it may be overwritten with a new block without first writing out the old block
If at least one write operation has been performed on a word in that line of the cache then main memory must be updated by writing the line of cache out to the block of memory before bringing in the new block
There are two problems to contend with:
More than one device may have access to main memory
A more complex problem occurs when multiple processors are attached to the same bus and each processor has its own local cache - if a word is altered in one cache it could conceivably invalidate a word in other caches
Write Through� and Write Back
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Line Size
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
When a block of data is retrieved and placed in the cache not only the desired word but also some number of adjacent words are retrieved
As the block size increases the hit ratio will at first increase because of the principle of locality
As the block size increases more useful data are brought into the cache
The hit ratio will begin to decrease as the block becomes bigger and the probability of using the newly fetched information becomes less than the probability of reusing the information that has to be replaced
Two specific effects come into play:
Multilevel Caches
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Unified Versus Split Caches
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Table 4.4
Intel
Cache Evolution
(Table is on page 150 in the textbook.)
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Summary
Chapter 7
Cache
Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.