文档详情

内存种类,局部性.ppt

发布:2017-06-06约2.02万字共95页下载文档
文本预览下载声明
10.4 Memory Mountain Lab Introduction(9/10) A Slope of Spatial Locality : Slice through memory mountain with size=256KB shows cache block/line size. 10.4 Memory Mountain Lab Introduction(10/10) * * 10.2. Memory Hierarchies(3/10) registers on-chip L1 cache (SRAM) main memory (DRAM) local secondary storage (local disks) Larger, slower, and cheaper (per byte) storage devices remote secondary storage (distributed file systems, Web servers) off-chip L2 cache (SRAM) L1 cache holds cache lines retrieved from the L2 cache memory. CPU registers hold words retrieved from L1 cache. L2 cache holds cache lines retrieved from main memory. L0: L1: L2: L3: L4: L5: Smaller, faster, and costlier (per byte) storage devices Access frequency 10.2. Memory Hierarchies(4/10) Why do memory hierarchies work? Programs tend to access the data at level k more often than they access the data at level k+1. Thus, the storage at level k+1 can be slower, and thus larger and cheaper per bit. Fundamental idea of a memory hierarchy: For each k, the faster, smaller device at level k serves as a cache for the larger, slower device at level k+1. level k+1 serves as a backup for level k * 10.2. Memory Hierarchies(5/10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Larger, slower, cheaper storage device at level k+1 is partitioned into blocks. Data is copied between levels in block-sized transfer units 8 9 14 3 Smaller, faster, more expensive device at level k caches a subset of the blocks from level k+1 Level k: Level k+1: 4 4 4 10 10 10 * 10.2. Memory Hierarchies(6/10) Request 14 Request 12 Program needs object d, which is stored in some block b. Cache hit Program finds b in the cache at level k. E.g., block 14. Cache miss b is not at level k, so level k cache must fetch it from level k+1. E.g., block 12. If level k cache is full, then some current block must be replaced (evicted). Which one is the “victim”? Placement policy: where can the new block go? E.g., b mod 4 Replacement policy: which b
显示全部
相似文档