memory hierarchy
play

Memory Hierarchy Lecture 25 CS301 Administrative Program #3 due - PowerPoint PPT Presentation

Memory Hierarchy Lecture 25 CS301 Administrative Program #3 due Friday, 12/7 at 4:59pm Daily Review due 11/29 at 8am Lab #8 due Friday 11/30 at 1:29pm HW #9 assigned w Due Wednesday, 12/5 at 4:59pm Virtual Memory DRAM as


  1. Memory Hierarchy Lecture 25 CS301

  2. Administrative • Program #3 due Friday, 12/7 at 4:59pm • Daily Review due 11/29 at 8am • Lab #8 due Friday 11/30 at 1:29pm • HW #9 assigned w Due Wednesday, 12/5 at 4:59pm

  3. Virtual Memory

  4. DRAM as cache • What about programs larger than DRAM? • When we run multiple programs, all must fit in DRAM! • Add another larger, slower level to the memory hierarchy - use part of the hard drive.

  5. Virtual Memory • Memory Size - • Protection -

  6. Virtual Memory • Memory Size - allows total memory allocation to exceed DRAM capacity. • Protection -

  7. Virtual Memory • Memory Size - allows total memory allocation to exceed DRAM capacity. • Protection - programs may not access each other’s memory.

  8. Multi-Processing - no VM • Program A begins Prog A

  9. Multi-Processing - no VM • Program A begins Prog A • Program B begins What happens if A wants more memory? Prog B

  10. Multi-Processing - no VM • Program A begins Prog A • Program B begins What happens if A wants more memory? Out of luck. If we gave A memory after the Prog B end of B, then A would be able to access all of B’s memory.

  11. Multi-Processing - no VM • Program A begins • Program B begins • Program A ends Prog B

  12. Multi-Processing - no VM • Program A begins • Program B begins Prog C • Program A ends • Program C ready Prog B

  13. Multi-Processing - no VM • Program A begins • Program B begins Prog C • Program A ends • Program C ready Prog B w It can not run even though there is enough free space w Fragmentation

  14. Virtual Memory • Use hard drive for memory that does not fit in DRAM • Allocate memory in pages • Provide protection by page

  15. Address Space • Virtual Address Space • Physical Address Space

  16. Address Space • Virtual Address Space w Located on Hard Drive (essentially) w Starts at 0 for each program • Physical Address Space

  17. Address Space • Virtual Address Space w Located on Hard Drive (essentially) w Starts at 0 for each program • Physical Address Space w Located in DRAM w The “cache” for the Disk Drive

  18. Multi-Processing - VM Virtual Address Physical Address 0 • Program A begins Prog A • Program B begins 16K Hard Drive

  19. Multi-Processing - VM Virtual Address Physical Address 0 • Program A begins Prog A • Program B begins 16K 0 Prog B 24K Hard Drive

  20. Multi-Processing - VM Virtual Address Physical Address 0 • Program A begins Prog A • Program B begins 16K What happens if A wants more 0 memory? Prog B 24K Hard Drive

  21. Multi-Processing - VM Virtual Address Physical Address 0 • Program A begins • Program B begins Prog A 20K What happens if A wants more 0 memory?Allocate another virtual page. Prog B 24K Hard Drive

  22. Multi-Processing - VM Virtual Address Physical Address • Program A begins • Program B begins • Program A ends 0 Prog B 24K Hard Drive

  23. Multi-Processing - VM Virtual Address 0 Physical Address • Program A begins Prog C • Program B begins • Program A ends 28K 0 • Program C begins w Not all placed in Prog B DRAM w DRAM use need not be contiguous 24K Hard Drive

  24. Virtual Memory is like caching… • _______ is the cache for the __________ w It contains only a subset of the total space • Given an address, determine whether it is currently in the “cache” • On a miss, obtain data and place in “cache”

  25. Virtual Memory is like caching… • DRAM is the cache for the hard drive w It contains only a subset of the total space • Given an address, determine whether it is currently in the “cache” • On a miss, obtain data and place in “cache”

  26. Virtual Memory is not like caching… • The miss penalty is orders of magnitude larger than for the cache • You must know where it resides in DRAM before you can look it up in L1 cache • This leads to a much different implementation

  27. The Search • Cache – search each block in set for the proper tag • Virtual Memory – store a table that is a mapping from virtual address to physical location (DRAM location).

  28. Virtual Memory Implementation • Programs use virtual addresses • VM Block is called a __________ • A VM DRAM “cache miss” is called a ______________. • To access data, the address must translate it to a _______________. • This translation is called _______________ or ________________.

  29. Virtual Memory Implementation • Programs use virtual addresses • VM Block is called a page • A VM DRAM “cache miss” is called a ______________. • To access data, the address must translate it to a _______________. • This translation is called _______________ or ________________.

  30. Virtual Memory Implementation • Programs use virtual addresses • VM Block is called a page • A VM DRAM “cache miss” is called a page fault. • To access data, the address must translate it to a _______________. • This translation is called _______________ or ________________.

  31. Virtual Memory Implementation • Programs use virtual addresses • VM Block is called a page • A VM DRAM “cache miss” is called a page fault. • To access data, the address must translate it to a _physical address_. • This translation is called _______________ or ________________.

  32. Virtual Memory Implementation • Programs use virtual addresses • VM Block is called a page • A VM DRAM “cache miss” is called a page fault. • To access data, the address must translate it to a _physical address_. • This translation is called memory mapping_ or _virtual to physical translation.

  33. Virtual Memory Implementation • Translation process: Virtual page number Page offset Translation Physical page number Page offset • Why is Physical address smaller than Virtual?

  34. Virtual Memory Implementation • Translation process: Virtual page number Page offset Translation Physical page number Page offset • Why is Physical address smaller than Virtual? DRAM is the cache – should be smaller than the total virtual address space

  35. Virtual Memory Implementation 
 Page faults incredibly costly • DRAM is a cache - w Direct-mapped? w Set-associative? w Fully associative? • Low associativity w miss rate, search time • High associativity w miss rate, search time

  36. Virtual Memory Implementation 
 Page faults incredibly costly • DRAM is a cache - w Direct-mapped? w Set-associative? w Fully associative? • Low associativity w high miss rate, low search time • High associativity w low miss rate, high search time

  37. Virtual Memory Implementation 
 Page faults incredibly costly • DRAM is a cache - w Direct-mapped? w Set-associative? w Fully associative? • Low associativity w high miss rate, low search time • High associativity w low miss rate, high search time Access time: ~50 cycles + search, miss penalty: hundreds of cycles

  38. Virtual Memory Implementation 
 Page fault incredibly costly • DRAM is a cache - w Direct-mapped? w Set-associative? w Fully associative !!!! • Low associativity w high miss rate, low search time • High associativity w low miss rate, high search time Access time: ~50 cycles + search, miss penalty: hundreds of cycles

  39. Virtual Memory Implementation 
 Page fault incredibly costly • Fully associative!!!! • Large block size (4KB-16KB) • Sophisticated software to implement replacement policy w updates are hidden under page fault penalty

  40. Address Space • Virtual Address Space w Located on Hard Drive (essentially) w Starts at 0 for each program • Physical Address Space w Located in DRAM w The “cache” for the Disk Drive

  41. Translation • Does the same virtual address (in all processes) always translate to the same physical address (at one moment in time)? • How often does a translation occur?

  42. Translation • Does the same virtual address always translate to the same physical address? w No - each process has same virtual addresses • How often does a translation occur?

  43. Translation • Does the same virtual address always translate to the same physical address? w No - each process has same virtual addresses w Store translations in process page table • How often does a translation occur?

  44. Translation • Does the same virtual address always translate to the same physical address? w No - each process has same Virtual addresses w Store translations in process page table • How often does a translation occur? w At least once per instruction

  45. Translation • Does the same virtual address always translate to the same physical address? w No - each process has same Virtual addresses w Store translations in process page table • How often does a translation occur? w At least once per instruction w Need to perform translation quickly w Cache recent translations!

  46. Translation • Maintaining per process page tables w Process page table maintained by ____ - ___________________________ • Making translations fast w Use a TLB (__________________________) to cache recent translations w Fully associative but ____________________

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend