address translation and tlb
play

ADDRESS TRANSLATION AND TLB Mahdi Nazm Bojnordi Assistant Professor - PowerPoint PPT Presentation

ADDRESS TRANSLATION AND TLB Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 6810: Computer Architecture Overview Announcement Homework 3 submission deadline: Nov. 11 th This lecture Virtual


  1. ADDRESS TRANSLATION AND TLB Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 6810: Computer Architecture

  2. Overview ¨ Announcement ¤ Homework 3 submission deadline: Nov. 11 th ¨ This lecture ¤ Virtual memory ¤ Page tables and address translation ¤ Translation look-aside buffer (TLB)

  3. Recall: Memory Hierarchy ¨ Lower levels provide greater capacity longer time ¤ Does the program fit in main memory? ¤ What if running multiple programs? Capacity: 8MB Cache Time: ~20 ns Greater Main Capacity: 8GB Capacity Memory Time: ~250 ns Capacity: 500GB Secondary Time: ~10 ms Memory

  4. Virtual Memory ¨ Use the main memory as a “cache” for secondary memory ¤ Placement policy? Main Memory for(i=0; i<100;++i) { a[i]++; } Disk

  5. Virtual Memory ¨ Use the main memory as a “cache” for secondary memory ¤ Placement policy? ¨ Allow efficient and safe sharing the physical main memory among multiple programs ¤ Replacement policy? Main Memory for(i=0; i<100;++i) { for(i=0; i<200;++i) { a[i]++; a[i]=a[i]+i; } } Disk

  6. Virtual Memory Systems ¨ Provides illusion of very large memory ¤ Address space of each program larger than the physical main memory ¨ Memory management unit (MMU) App ¤ Between main and secondary mem. Virtual Address Space ¤ Address translation n Virtual address space used by the program n Physical address space is provided by the physical main memory Secondary Memory

  7. Virtual Memory Systems ¨ Provides illusion of very large memory ¤ Address space of each program larger than the physical main memory ¨ Memory management unit (MMU) App ¤ Between main and secondary mem. Virtual Address Space ¤ Address translation n Virtual address space used by the Translation program Main Memory n Physical address space is provided by the physical main memory Secondary Memory

  8. Virtual Address ¨ Every virtual address is translated to a physical address with the help of hardware ¨ Data granularity Virtual Address Physical Memory 31 0 0 Physical Address 29 0 1G

  9. Virtual Address ¨ Every virtual address is translated to a physical address with the help of hardware ¨ Data granularity Virtual Address Physical Memory 31 0 0 Page Frame 0 Page Physical Address 29 0 Frame 1 Page Frame 2 … Page Frame N-1 1G

  10. Virtual Address ¨ Every virtual address is translated to a physical address with the help of hardware ¨ Data granularity Virtual Address Physical Memory 31 0 0 offset Page Frame 0 Page Physical Address 29 0 Frame 1 offset Page Frame 2 … Page Frame N-1 1G

  11. Virtual Address ¨ Every virtual address is translated to a physical address with the help of hardware ¨ Data granularity Virtual Address Physical Memory 31 0 0 Virtual Page No offset Page Frame 0 Page Physical Address 29 0 Frame 1 Page frame No offset Page Frame 2 Translator … Page Frame N-1 1G

  12. Virtual Address ¨ Every virtual address is translated to a physical address with the help of hardware ¨ Data granularity Virtual Address Physical Memory 31 0 0 Virtual Page No offset Page Frame 0 Page Physical Address 29 0 Frame 1 Page frame No offset Page Frame 2 … What is the table size? Page Frame N-1 Page Table 1G

  13. Address Translation Issues ¨ Where to store the table? ¤ Too big for on-chip cache ¤ Should be maintained in the main memory

  14. Address Translation Issues ¨ Where to store the table? ¤ Too big for on-chip cache ¤ Should be maintained in the main memory ¨ What to do on a page table miss (page fault)? ¤ No valid frame assigned to the virtual page ¤ OS copies the page from disk to page frame

  15. Address Translation Issues ¨ Where to store the table? ¤ Too big for on-chip cache ¤ Should be maintained in the main memory ¨ What to do on a page table miss (page fault)? ¤ No valid frame assigned to the virtual page ¤ OS copies the page from disk to page frame ¨ What is the cost of address translation? ¤ Additional accesses to main memory per every access ¤ Optimizations?

  16. Address Translation Cost ¨ Page walk: look up the physical address in the page table ¤ How many pages to store the page table? Virtual Address 20 12 base à Page frame No 12 Physical Address Page Table

  17. Multi-Level Page Table ¨ The virtual (logical) address space is broken down into multiple pages ¤ Example: 4KB pages Virtual Address 10 10 12 base à Page frame No 12 Physical Address

  18. Translation Lookaside Buffer ¨ Exploit locality to reduce address translation time ¤ Keep the translation in a buffer for future references Virtual Address Physical Memory Virtual Page No offset Page Frame 0 Page Frame 1 Page frame No offset Page Frame 2 Physical Address … Page Frame N-1 Page Table

  19. Translation Lookaside Buffer ¨ Exploit locality to reduce address translation time ¤ Keep the translation in a buffer for future references 0 Virtual 1 TLB Address Physical Memory 0 Virtual Page No offset Page 1 Frame 0 Page Frame 1 Page frame No offset Page Frame 2 Physical Address … Page Frame N-1 Page Table

  20. Translation Lookaside Buffer ¨ Just like any other cache, the TLB can be organized as fully associative, set associative, or direct ¨ TLB access is typically faster than cache access ¤ Because TLBs are much smaller than caches ¤ TLBs are typically not more than 128 to 256 entries even on high-end machines V Virtual Page # Physical Page # Dirty Status

  21. CAM Based TLB ¨ Content addressable memory (CAM) ¤ Unlike RAM, data in address out CAM: Search Operation RAM: Read Operation Data in Address in Decoder address match Data out

  22. CAM Based TLB ¨ Content addressable memory (CAM) ¤ Unlike RAM, data in address out ¨ CAM based TLB What if multiple rows match? ¤ Both CAM and RAM are used Virtual Page No RAM CAM Physical Page No Dirty Status

  23. TLB in Memory Hierarchy ¨ On a TLB miss, is the page loaded in memory? ¤ Yes: takes 10’s cycles to update the TLB ¤ No: page fault n Takes 1,000,000’s cycles to load the page and update TLB hit PA VA miss Processor TLB Main Cache Core Lookup Memory hit Data

  24. TLB in Memory Hierarchy ¨ On a TLB miss, is the page loaded in memory? ¤ Yes: takes 10’s cycles to update the TLB ¤ No: page fault n Takes 1,000,000’s cycles to load the page and update TLB hit PA VA miss Processor TLB Main Cache Core Lookup Memory miss hit Translaltion Data

  25. TLB in Memory Hierarchy ¨ On a TLB miss, is the page loaded in memory? ¤ Yes: takes 10’s cycles to update the TLB ¤ No: page fault n Takes 1,000,000’s cycles to load the page and update TLB Physically indexed, physically tagged: TLB on critical path! hit PA VA miss Processor TLB Main Cache Core Lookup Memory miss hit Translaltion Data

  26. Physically Indexed Caches ¨ Problem: increased critical path due to sequential access to TLB and cache Virtual Page No Page Offset TLB Physical Frame Page Offset

  27. Physically Indexed Caches ¨ Problem: increased critical path due to sequential access to TLB and cache Virtual Page No Page Offset TLB Physical Frame Page Offset Tag Index Byte Tag Array Data Array = Data Block hit/miss*

  28. Physically Indexed Caches ¨ Problem: increased critical path due to sequential access to TLB and cache Virtual Page No Page Offset Observation: lower address TLB bits (page offset) are not translated Physical Frame Page Offset Tag Index Byte Tag Array Data Array = Data Block hit/miss*

  29. Virtually Indexed Caches ¨ Idea: Index into cache in parallel with page number translation in TLB Virtual Page No Page Offset Index Byte TLB Tag Array Data Array Tag Data Block = hit/miss*

  30. Virtually Indexed Caches ¨ Idea: Index into cache in parallel with page number translation in TLB what if the page offset is not Virtual Page No Page Offset equal to index+byte? Index Byte TLB Tag Array Data Array Tag Data Block = hit/miss*

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