Escolar Documentos
Profissional Documentos
Cultura Documentos
Introduction
Memory access time is important to performance! Users want large memories with fast access times ideally unlimited fast memory To use an analogy, think of a bookshelf containing many books:
Suppose you are writing a paper on birds. You go to the bookshelf, pull out some of the books on birds and place them on the desk. As you start to look through them you realize that you need more references. So you go back to the bookshelf and get more books on birds and put them on the desk. Now as you begin to write your paper, you have many of the references you need on the desk in front of you.
CPU
Farther away from the CPU: Lower Cost/Bit Higher Capacity Increased Access Time/Latency Lower Throughput/ Bandwidth
Registers
Cache Level(s)
Main Memory
Magnetic Disc
Optical Disk or Magnetic Tape
55:035 Computer Architecture and Organization 3
faster
OS 4K-16K bytes
user/operator Mbytes
Larger
Memory Hierarchy
We can exploit the natural locality in programs by implementing the memory of a computer as a memory hierarchy.
Multiple levels of memory with different speeds and sizes. The fastest memories are more expensive, and usually much smaller in size (see figure).
Accomplished by using efficient methods for memory structure and organization.
The user has the illusion of a memory that is both large and fast.
Inventor of Cache
M. V. Wilkes, Slave Memories and Dynamic Storage Allocation, IEEE Transactions on Electronic Computers, vol. EC-14, no. 2, pp. 270-271, April 1965.
55:035 Computer Architecture and Organization 6
Cache
Processor
words
Processor does all memory operations with cache. Miss If requested word is not in cache, a block of words containing the requested word is brought to cache, and then the processor request is completed. Hit If the requested word is in cache, read or write operation is performed directly in cache, without accessing main memory. Block minimum amount of data transferred between cache and main memory.
A program tends to access data that form a physical cluster in the memory multiple accesses may be made within the same block. Physical localities are temporal and may shift over longer periods of time data not used for some time is less likely to be used in the future. Upon miss, the least recently used (LRU) block can be overwritten by a new block. P. J. Denning, The Locality Principle, Communications of the ACM, vol. 48, no. 7, pp. 19-24, July 2005.
Most programs contain natural locality in structure. For example, most programs contain loops in which the instructions and data need to be accessed repeatedly. This is an example of temporal locality. Instructions are usually accessed sequentially, so they contain a high amount of spatial locality. Also, data access to elements in an array is another example of spatial locality.
55:035 Computer Architecture and Organization 9
Block 2
10
Memory system is organized as a hierarchy with the level closest to the processor being a subset of any level further away, and all of the data is stored at the lowest level (see figure). Data is copied between only two adjacent levels at any given time. We call the minimum unit of information contained in a two-level hierarchy a block or line. See the highlighted square shown in the figure. If data requested by the user appears in some block in the upper level it is known as a hit. If data is not found in the upper levels, it is known as a miss.
55:035 Computer Architecture and Organization 11
Compare Tags
? Hit
Direct-Mapped Cache
Memory
Block 2 Swap-in
Set-Associative Cache
Memory
15
Direct-Mapped Placement
Block placement & replacement choices are both completely determined by the address of the new block that is to be accessed.
16