Presentation is loading. Please wait.

Presentation is loading. Please wait.

Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 14: Memory Hierarchy Chapter 5 (4.

Similar presentations


Presentation on theme: "Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 14: Memory Hierarchy Chapter 5 (4."— Presentation transcript:

1 Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 14: Memory Hierarchy Chapter 5 (4 th edition), 7 (3 rd edition) http://www.ecs.umass.edu/ece/ece232/

2 ECE232: Memory Hierarchy 2 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Recap: Machine Organization Personal Computer Processor (CPU) (active) Computer Control (“brain”) Datapath Memory (passive) (where programs, & data live when running) Devices Input Output

3 ECE232: Memory Hierarchy 3 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Basics  Users want large and fast memories!  Fact Large memories are slow Fast memories are small  Large memories use DRAM technology: Dynamic Random Access Memory High density, low power, cheap, slow Dynamic: needs to be “refreshed” regularly  DRAM access times are 50-70ns at cost of $10 to $20 per GB FPM (Fast Page Mode) ECC (Error Correcting Code) SDRAM (Synchronous Dynamic RAM) DDR (Data Transfer at both edges), source synchronous  Fast memories use SRAM: Static Random Access Memory Low density, high power, expensive, fast Static: content last “forever”(until lose power)  SRAM access times are.5 – 5ns at cost of $400 to $1,000 per GB

4 ECE232: Memory Hierarchy 4 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Technology  SRAM and DRAM are: Random Access storage Access time is the same for all locations (Hardware decoder used)  For even larger and cheaper storage (than DRAM) use hard drive (Disk): Sequential Access Very slow, Data accessed sequentially, access time is location dependent, considered as I/O Disk access times are 5 to 20 million ns (i.e., msec) at cost of $.20 to $2.00 per GB

5 ECE232: Memory Hierarchy 5 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Latency Problem µProc 60%/yr. (2X/1.5yr) DRAM 5%/yr. (2X/15 yrs) 1 10 100 1000 198019811983198419851986198719881989199019911992199319941995199619971998199920001982 Processor-Memory Performance Gap: (grows 50% / year) Performance Time Processor-DRAM Memory Performance Gap Motivation for Memory Hierarchy

6 ECE232: Memory Hierarchy 6 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Need for speed  Assume CPU runs at 3GHz  Every instruction requires 4B of instruction and at least one memory access (4B of data) 3 * 8 = 24GB/sec  Peak performance of sequential burst of transfer (Performance for random access is much much slower due to latency)  Memory bandwidth and access time is a performance bottleneck InterfaceWidthFrequencyBytes/Sec 4-way interleaved PC1600 (DDR200) SDRAM4 x64bits100 MHz DDR6.4 GB/s Opteron Hyper- Transport memory bus128bits200 MHz DDR6.4 GB/s Pentium 4 "800 MHz" FSB64bits200 MHz QDR6.4 GB/s PC2 6400 (DDR-II 800) SDRAM64bits400 MHz DDR6.4 GB/s PC2 5300 (DDR-II 667) SDRAM64bits333 MHz DDR5.3 GB/s Pentium 4 "533 MHz" FSB64bits133 MHz QDR4.3 GB/s FSB – Front-Side Bus

7 ECE232: Memory Hierarchy 7 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Need for Large Memory  Small memories are fast  So just write small programs “640 K of memory should be enough for anybody” -- Bill Gates, 1981  Today’s programs require large memories Powerpoint 2003 – 25 megabytes Data base applications may require Gigabytes of memory

8 ECE232: Memory Hierarchy 8 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren The Goal: Illusion of large, fast, cheap memory  How do we create a memory that is large, cheap and fast (most of the time)?  Strategy: Provide a Small, Fast Memory which holds a subset of the main memory – called cache Keep frequently-accessed locations in fast cache Cache retrieves more than one word at a time Sequential accesses are faster after first access

9 ECE232: Memory Hierarchy 9 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Hierarchy  Hierarchy of Levels Uses smaller and faster memory technologies close to the processor Fast access time in highest level of hierarchy Cheap, slow memory furthest from processor  The aim of memory hierarchy design is to have access time close to the highest level and size equal to the lowest level

10 ECE232: Memory Hierarchy 10 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Hierarchy Pyramid Processor (CPU) Size of memory at each level Level 1 Level 2 Level n Increasing Distance from CPU, Decreasing cost / MB Level 3... transfer datapath: bus Decreasing distance from CPU, Decreasing Access Time (Memory Latency)

11 ECE232: Memory Hierarchy 11 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Basic Philosophy  Move data into ‘smaller, faster’ memory  Operate on it  Move it back to ‘larger, cheaper’ memory How do we keep track if changed  What if we run out of space in ‘smaller, faster’ memory?  Important Concepts: Latency, Bandwidth

12 ECE232: Memory Hierarchy 12 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Typical Hierarchy  Notice that the data width is changing Why?  Bandwidth: Transfer rate between various levels CPU-Cache: 24 GBps Cache-Main: 0.5-6.4GBps Main-Disk: 187MBps (serial ATA/1500) CPU regs CacheCache Memory disk 8 B32 B4 KB Cache/MMvirtual memory

13 ECE232: Memory Hierarchy 13 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Bandwidth Issue  Fetch large blocks at a time (Bandwidth) Supports spatial locality for (i=0; i < length; i++) sum += array[i]; array has spatial locality sum has temporal locality

14 ECE232: Memory Hierarchy 14 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Why Hierarchy works: Natural Locality  The Principle of Locality Programs access a relatively small portion of the address space at any second Memory Address 02 n - 1 Probability of reference  Temporal Locality (Locality in Time): Recently accessed data tend to be referenced again soon  Spatial Locality (Locality in Space): nearby items will tend to be referenced soon 1 0

15 ECE232: Memory Hierarchy 15 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Hierarchy: Terminology  Hit: data appears in upper level in block X  Hit Rate: the fraction of memory accesses found in the upper level  Miss: data needs to be retrieved from a block in the lower level (Block Y)  Miss Rate = 1 - (Hit Rate)  Hit Time: Time to access the upper level which consists of Time to determine hit/miss + upper level access time  Miss Penalty: Time to replace a block in the upper level + Time to deliver the block to the processor  Note: Hit Time << Miss Penalty Lower Level Upper Level To Processor From Processor Block X Block Y

16 ECE232: Memory Hierarchy 16 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Current Memory Hierarchy Speed(ns):1ns2ns6ns100ns10,000,000ns Size (MB):0.00050.11-41000-6000500,000 Cost ($/MB):--$10$3$0.01 $0.002 Technology:RegsSRAMSRAMDRAMDisk Control Data- path Processor regs Secondary Memory L2 Cache L1 Cache Main Memory Cache - Main memory: Speed Main memory – Disk (virtual memory): Capacity

17 ECE232: Memory Hierarchy 17 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren How is the hierarchy managed?  Registers « Memory By the compiler (or assembly language Programmer)  Cache « Main Memory By hardware  Main Memory « Disks By combination of hardware and the operating system virtual memory Also by the programmer (in case of files) Control Data- path Processor regs Secondary Memory L2 Cache L1 Cache Main Memory

18 ECE232: Memory Hierarchy 18 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Memory Hierarchy Design Four Questions for Memory Hierarchy Q1: Where to place a block in upper level? (Block placement) Anywhere, in a single specific place, in one out of several specific places Q2: How to find a block in a the upper level? (Block identification) Q3: Which block should be replaced on a miss in upper level? (Block replacement) Replacement policy Q4: What happens on a write in upper level? (Write strategy)

19 ECE232: Memory Hierarchy 19 Adapted from Computer Organization and Design,Patterson&Hennessy, UCB, Kundu,UMass Koren Q4: What happens on a write?  Write policies Write–through—The information is written to both upper and lower level easier to implement the lower level has the most current copy of the data (Data consistency, coherence) Write–back—The information is only written to the upper level; the modified block is written to the lower level only when it is replaced uses less bandwidth, since multiple writes within a block only requires one write to lower level a read miss (which causes a block to be replaced and therefore) may result in writes to lower level  A block in a write–back upper level can be either clean or dirty, depending on whether the block content is the same as that in lower level


Download ppt "Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 14: Memory Hierarchy Chapter 5 (4."

Similar presentations


Ads by Google