3/1/2002CSE 141 - Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.

Slides:



Advertisements
Similar presentations
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
Advertisements

Virtual Memory Really this is in OS – but We need to see how the OS will interact with the HW Peer Instruction Lecture Materials for Computer Architecture.
1 Lecture 13: Cache and Virtual Memroy Review Cache optimization approaches, cache miss classification, Adapted from UCB CS252 S01.
COMP381 by M. Hamdi 1 Virtual Memory. COMP381 by M. Hamdi 2 Virtual Memory: The Problem For example: MIPS64 is a 64-bit architecture allowing an address.
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.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Caching IV Andreas Klappenecker CPSC321 Computer Architecture.
Cs 325 virtualmemory.1 Accessing Caches in Virtual Memory Environment.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Virtual Memory 2 P & H Chapter
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
1 Lecture 20 – Caching and Virtual Memory  2004 Morgan Kaufmann Publishers Lecture 20 Caches and Virtual Memory.
Chap. 7.4: Virtual Memory. CS61C L35 VM I (2) Garcia © UCB Review: Caches Cache design choices: size of cache: speed v. capacity direct-mapped v. associative.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley and Rabi Mahapatra & Hank Walker.
Virtual Memory.
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
The Memory Hierarchy II CPSC 321 Andreas Klappenecker.
Technical University of Lodz Department of Microelectronics and Computer Science Elements of high performance microprocessor architecture Virtual memory.
ECE 232 L27.Virtual.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 27 Virtual.
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy (Part II)
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
1 CSE SUNY New Paltz Chapter Seven Exploiting Memory Hierarchy.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Some VM Complications Extra memory accesses Page tables are huge
Lecture 19: Virtual Memory
1  2004 Morgan Kaufmann Publishers Multilevel cache Used to reduce miss penalty to main memory First level designed –to reduce hit time –to be of small.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
IT253: Computer Organization
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
CSIE30300 Computer Architecture Unit 08: Cache Hsin-Chou Chi [Adapted from material by and
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.
1  1998 Morgan Kaufmann Publishers Recap: Memory Hierarchy of a Modern Computer System By taking advantage of the principle of locality: –Present the.
1 Some Real Problem  What if a program needs more memory than the machine has? —even if individual programs fit in memory, how can we run multiple programs?
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
1  1998 Morgan Kaufmann Publishers Chapter Seven.
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)
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
Summary of caches: The Principle of Locality: –Program likely to access a relatively small portion of the address space at any instant of time. Temporal.
CS203 – Advanced Computer Architecture Virtual Memory.
CDA 5155 Virtual Memory Lecture 27. Memory Hierarchy Cache (SRAM) Main Memory (DRAM) Disk Storage (Magnetic media) CostLatencyAccess.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
CDA 3101 Spring 2016 Introduction to Computer Organization Physical Memory, Virtual Memory and Cache 22, 29 March 2016.
CS161 – Design and Architecture of Computer
Lecture 11 Virtual Memory
Improving Memory Access The Cache and Virtual Memory
Virtual Memory Chapter 7.4.
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Section 9: Virtual Memory (VM)
Morgan Kaufmann Publishers
CSCI206 - Computer Organization & Programming
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
FIGURE 12-1 Memory Hierarchy
Lecture 29: Virtual Memory-Address Translation
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Translation Buffers (TLBs)
Presentation transcript:

3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED. Figures may be reproduced only for classroom or personal education use in conjunction with our text and only when the above line is included.

CSE Virtual Memory2 Virtual Memory Goal: every process thinks it has a huge memory... –Virtual address space: addresses 0 to 2 32 –1 (or 0 to 2 64 –1 on machines with 64-bit addressing). even if there is much less physical memory.... entirely to itself. –Virtual memory also provides protection One process can’t corrupt the data of another Another user, running on the same machine, can’t see your data

CSE Virtual Memory3 There can be many virtual address spaces physical addresses virtual addresses disk

CSE Virtual Memory4 Virtual Memory Can be seen as another level in the memory hierarchy –Main memory is a cache of a larger memory space. –Disk holds data in VM that doesn’t fit in cache –VM may be bigger than disk cpu cache memory disk virtual memory If a process doesn’t use the entire virtual memory, there will be addresses that have no storage assigned.

CSE Virtual Memory5 Virtual Memory For historical reasons, it uses different terminology CacheVM block (line)page cache misspage fault addressvirtual address

CSE Virtual Memory6 How VM differs from memory caches MUCH higher miss penalty (millions of cycles)! Therefore: –large pages [equivalent of cache line] (4 KB to MBs) –associative mapping of pages (typically fully associative) –software handling of misses (but HW handles hits!!) –write-through never used, only write-back Many pages –With 64 MByte memory, 4KBytes/pages, have 16K pages It’s not practical to have 16K comparitors Nor to have software do many comparisons –How can we get virtual memory with full associativity???

CSE Virtual Memory7 Implementation: Page Table Page table maps virtual memory addresses to physical memory locations –Page may be in main memory or may be on disk. “Valid bit” says which. Virtual page number (high order bits of virtual address)

Address translation via the page table virtual page number page offset valid physical page number page table reg physical page numberpage offset virtual address physical address page table Why don’t we need a “tag” field? Why is this fully associative?? How does operating system switch to new process??? This hardware register tells VM system where to find the page table.

CSE Virtual Memory9 How big is the page table? Answer: Pretty big –Example: 512 MB virtual addresses space, 4 KB pages. Then we need 2 29 / 2 12 = 2 17 entries in the page table. –Suppose each entry is 4 Bytes. Then page table takes 2 19 Bytes (a half megabyte) –... and each process needs its own page table. –So part of page table may not even be in cache. Page table manager is part of Operating System, but... We care about performance; can you avoid loading a page table entry on every memory reference? –Otherwise, VM would slow out-of-cache memory references down by a factor of two.

CSE Virtual Memory10 Making Address Translation Fast Translation lookaside buffer (TLB) A hardware cache for the page table Typical size: 256 entries, 1- to 4-way set associative

CSE Virtual Memory11 How do cache and VM fit together? Cache can be virtually addressed... –the virtual address is broken into tag-index-offset to look up data in cache... or physically addressed –the virtual address is first converted to a physical address (using the page table) –the physical address is used to find data in cache Virtually addressed caches are faster, but make sharing data between processes complicated. One compromise is to use virtual address for the index and physical address for the tag.

CSE Virtual Memory12 TLB and physically addressed cache

CSE Virtual Memory13 Putting it all together Suppose we have: –64-bit virtual addresses –36-bit physical addresses –8 KB pages –256 entry, 2-way set associative TLB –32 KB direct mapped virtually addressed cache –64 Byte long cache lines

CSE Virtual Memory14 Virtual Memory Key Points Virtual memory provides: –protection –sharing –performance –illusion of large main memory Virtual Memory requires twice as many memory accesses, so we cache page table entries in the TLB. Four things can go wrong on a memory access: cache miss, TLB miss (but page table in cache), TLB miss and page table not in cache, page fault.