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)

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
Caching IV Andreas Klappenecker CPSC321 Computer Architecture.
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
Spring 2003CSE P5481 Introduction Why memory subsystem design is important CPU speeds increase 55% per year DRAM speeds increase 3% per year rate of increase.
Virtual Memory Chapter 8.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
S.1 Review: The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
The Memory Hierarchy II CPSC 321 Andreas Klappenecker.
Translation Buffers (TLB’s)
©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
Computer Architecture Lecture 28 Fasih ur Rehman.
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
Lecture 19: Virtual Memory
Lecture 15: Virtual Memory EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2014, Dr.
IT253: Computer Organization
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
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)
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.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
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.
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”
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
CS203 – Advanced Computer Architecture Virtual Memory.
Memory Management & Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Lecture 11 Virtual Memory
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Virtual Memory User memory model so far:
Section 9: Virtual Memory (VM)
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Memory Hierarchy Virtual Memory, Address Translation
Consider a Direct Mapped Cache with 4 word blocks
CS510 Operating System Foundations
CSCI206 - Computer Organization & Programming
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Part V Memory System Design
Virtual Memory 4 classes to go! Today: Virtual Memory.
Lecture 29: Virtual Memory-Address Translation
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Lecture 9: Caching and Demand-Paged Virtual Memory
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Translation Buffers (TLBs)
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

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) Page might be in physical memory or on disk. Addresses: Generated by lw/sw: virtual Actual memory locations: physical

Memory access Load/store/PC computes a virtual address Need address translation Convert virtual addr to physical addr Use page table for lookup Check virtual address: If page is in memory, access memory with physical address May also need to check access permissions If page is in not in memory, access disk Page fault Slow – so run another program while it’s doing that Do translation in hardware Software translation would be too slow!

Handling a page fault Occurs during memory access clock cycle Handler must: Find disk address from page table entry Choose physical page to replace if page dirty, write to disk first Read referenced page from disk into physical page

TLB: Translation Lookaside Buffer Address translation has a high degree of locality If page accessed once, highly likely to be accessed again soon. So, cache a few frequently used page table entries TLB = hardware cache for the page table Make translation faster Small, frequently fully-associative TLB entries contain Valid bit Other housekeeping bits Tag = virtual page number Data = Physical page number Misses handled in hardware (dedicated FSM) or software (OS code reads page table)

TLB Misses TLB miss means one of two things Page is present in memory, need to create the missing mapping in the TLB Page is not present in memory (page fault), need to transfer control to OS to deal with it. Need to generate an exception Copy page table entry to TLB – use appropriate replacement algorithm if you need to evict an entry from TLB.

Optimizations Make the common case fast Speed up TLB hit + L1 Cache hit Do TLB lookup and cache lookup in parallel Possible if cache index is independent of virtual address translation Have cache indexed by virtual addresses

TLB Example , 7.33 Given: 40-bit virtual addr 16KB pages 36-bit physical byte address 2-way set associative TLB with 256 total entries Total page table size? Memory organization?

Page table/address parameters 16KB=2^14, so 16K pages need 14 bits for an offset inside a page. The rest of the virtual address is the virtual page index, and it's = 26 bits long, for 2^26 page table entries. Each entry contains 4 bits for valid/protection/dirty information, and the physical frame number, which is = 22 bits long, for a total of 26 bits. The total page table size is then 26 bits * 2^26 entries = 208 MB

Memory organization with TLB tagindexpage offset 26-bit virtual page number valid/etc. Tagphysical page # valid/etc. tagphysical page # ………… == 2-1 MUX 22 physical page #page offset Physical Address 2214 TLB: 128 sets, each w/2 entries