Memory Hierarchy Virtual Memory, Address Translation

Slides:



Advertisements
Similar presentations
SE-292 High Performance Computing
Advertisements

EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
COMP 3221: Microprocessors and Embedded Systems Lectures 27: Virtual Memory - III Lecturer: Hui Wu Session 2, 2005 Modified.
Virtual Memory 3 Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University P & H Chapter
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Virtual Memory 2 P & H Chapter
S.1 Review: The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
The Three C’s of Misses 7.5 Compulsory Misses The first time a memory location is accessed, it is always a miss Also known as cold-start misses Only way.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
CS203 – Advanced Computer Architecture Virtual Memory.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
CMSC 611: Advanced Computer Architecture
COSC6385 Advanced Computer Architecture Lecture 7. Virtual Memory
Vivek Seshadri 15740/18740 Computer Architecture
Virtual Memory Chapter 7.4.
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Section 9: Virtual Memory (VM)
From Address Translation to Demand Paging
Module: Virtual Memory
CS 704 Advanced Computer Architecture
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2018
CSCI206 - Computer Organization & Programming
Virtual Memory 3 Hakim Weatherspoon CS 3410, Spring 2011
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Part V Memory System Design
From Address Translation to Demand Paging
Andy Wang Operating Systems COP 4610 / CGS 5765
FIGURE 12-1 Memory Hierarchy
Andy Wang Operating Systems COP 4610 / CGS 5765
Some of the slides are adopted from David Patterson (UCB)
Translation Lookaside Buffer
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Translation Buffers (TLB’s)
Virtual Memory Overcoming main memory size limitation
© 2004 Ed Lazowska & Hank Levy
Virtual Memory Prof. Eric Rotenberg
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
Translation Lookaside Buffers
CSE 153 Design of Operating Systems Winter 2019
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Translation Buffers (TLBs)
CS161 – Design and Architecture of Computer
Virtual Memory.
Sarah Diesburg Operating Systems CS 3430
Andy Wang Operating Systems COP 4610 / CGS 5765
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Sarah Diesburg Operating Systems COP 4610
Presentation transcript:

Memory Hierarchy Virtual Memory, Address Translation Slides contents from: Hennessy & Patterson, 5ed. Appendix B and Chapter 2. David Wentzlaff, ELE 475 – Computer Architecture. MJT, High Performance Computing, NPTEL.

Process/Program Address Space Byte Address CODE Compiler assumes a linear address space Byte 0 to Byte 232-1 Virtual Address space The entire process data structure may not be present in MM at all times. . DATA HEAP STACK 232-1

Paged Virtual Memory . . . Page Number 0 MAIN MEMORY Virtual Address Space MAIN MEMORY Byte Page Number 13 Virtual Page Number 0 Physical Address Space . Virtual Page Number 1 Page Number 1 . Page Number 2 . HARD DISK Page Number N-1 Virtual Page Number N-1 232-1

The Memory Hierarchy Physical Addresses Virtual Addresses Virtual

Address Translation Table Physical Page Numbers Virtual Address VPN 0 PPN 0 VPN PO VPN 1 . PPN . PPN PO Physical Address VPN N-1

Paged Virtual Memory 48 bit Virtual Addresses, 40 bit Physical Addresses. Page size = 16KB. How many entries in a process's Page Translation Table? What is the size of the Page Translation Table?

Virtual Memory

Address Translation Table MAIN MEMORY HARD DISK Physical Page Numbers Disk Addresses V Virtual Address VPN 0 VPN PO VPN 1 PPN Disk Address PPN PO Physical Address VPN N

Implementation of Address Translation Process always uses virtual addresses Memory Management Unit (MMU): part of CPU; hardware that does address translation The page tables are (at best) present in the MM (OS virtual address space) One main memory reference per address translation! To translate a virtual memory address, the MMU has to read the relevant page table entry out of memory Caches recently used translations in a Translation Lookaside Buffer (Page Table Cache)

Caches and Address Translation Physically Addressed Cache Virtual Address Physical Address CPU MMU Cache Main Memory Virtual Address Cache Miss Physical Address CPU Cache MMU Virtually Addressed Cache

Which is less preferable? Physical addressed cache Hit time higher (cache access after translation) Virtual addressed cache Data/instruction of different processes with same virtual address in cache at the same time ... Flush cache on context switch, or Include Process id as part of each cache directory entry Synonyms Virtual addresses that translate to same physical address More than one copy of a block in cache ...

Synonyms (Aliases) L2 uses virtual addresses VA-T1 VA-T2 P1 t1 P2 t2 Shared L2 L2 uses virtual addresses T1 and T2 share data from page X X 2 copies of one physical page in the cache!

Virtually Indexed Physically Tagged Cache (VIPT) Overlapped Operation MMU Virtual Address Tag check using PA Cache CPU Indexing using VA Virtually Indexed Physically Tagged Cache (VIPT) Other options: PIPT, VIVT

Recall – Cache Access =? Direct mapped, 32 KB, 32B block, 32b main memory address 32 b address Tag is not needed until the cache line has been read Tag Index (10b) 3 Offset 2 W 1 32B Block W 2 ... 7 W 8 To Processor W 1 W 2 ... 7 W 8 =? . . . No Cache Miss Yes Cache Hit

VM Example =? =? =? 64 b VM address Virtual Page No. (50) Page Offset (14) (43) (7) TLB Tag TLB Index Index (8) Offset (6) (26) 26b Cache Block Physical Address (Tag) =? =? L1 Hit/Miss TLB Hit/ Page Fault Physical Address (40) To L2 Tag Index Offset L2 Cache Block Index comes from the Virtual Address (Virtually Indexed) =? Tag comes from the Physical Address (Physically tagged)

Fast Translation Address translation is on the critical path Paging – 2 memory accesses! Address Translation Table + Data Translation Lookaside Buffer (TLB): Part of MMU that caches address translations

Page Fault Virtual address generated by processor is not available in main memory Detected on attempt to translate address Page Table entry is invalid Must be `handled’ by operating system Identify slot in main memory to be used Get page contents from disk Update page table entry Provide data to the processor

Size of a Page Page is the unit of Memory Management Too large vs. Too small. Page Offset field need not be translated What if the Page Offset field was 12 bits? (Page size = 4KB)

Translation Lookaside Buffer Cache of page table mappings 32 – 4096 entries long SA, FA, or DM Dirty flag – use during page write back Ref – used for LRU VPN (tag) PPN (data) Valid Ref Dirty Access Rights