Page that info back into your memory!

Slides:



Advertisements
Similar presentations
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
Advertisements

COMP 3221: Microprocessors and Embedded Systems Lectures 27: Virtual Memory - III Lecturer: Hui Wu Session 2, 2005 Modified.
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
1 Lecture 14: Virtual Memory Topics: virtual memory (Section 5.4) Reminders: midterm begins at 9am, ends at 10:40am.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
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.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
Virtual Memory I Chapter 8.
CS 61C: Great Ideas in Computer Architecture
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
CS 241 Section Week #12 (04/22/10).
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
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 Expanding Memory Multiple Concurrent Processes.
Instructor: Dan Garcia 1 CS 61C: Great Ideas in Computer Architecture Virtual Memory III.
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.
Ch7d- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Individual Space Every process wants its own space Ideally, it would like.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Review (1/2) °Caches are NOT mandatory: Processor performs arithmetic Memory stores data Caches simply make data transfers go faster °Each level of memory.
Virtual Memory 1 1.
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?
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Carnegie Mellon Introduction to Computer Systems / Spring 2009 March 23, 2009 Virtual Memory.
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)
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
CS203 – Advanced Computer Architecture Virtual Memory.
Memory Management & Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
CS161 – Design and Architecture of Computer
CMSC 611: Advanced Computer Architecture
Lecture 11 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.
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
A Real Problem What if you wanted to run a program that needs more memory than you have? September 11, 2018.
Virtual Memory User memory model so far:
From Address Translation to Demand Paging
CS703 - Advanced Operating Systems
Section 9: Virtual Memory (VM)
Today How was the midterm review? Lab4 due today.
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?
Memory Hierarchy Virtual Memory, Address Translation
Lecture: Large Caches, Virtual Memory
CSE 153 Design of Operating Systems Winter 2018
Virtual Memory Chapter 8.
Guest Lecturer: Justin Hsia
CSCI206 - Computer Organization & Programming
Replacement Policies Assume all accesses are: Cache Replacement Policy
Lecture 23: Cache, Memory, Virtual Memory
Computer Architecture
Lecture 29: Virtual Memory-Address Translation
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Virtual Memory Prof. Eric Rotenberg
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
CSE 153 Design of Operating Systems Winter 2019
Operating Systems: Internals and Design Principles, 6/E
Review What are the advantages/disadvantages of pages versus segments?
Virtual Memory 1 1.
Presentation transcript:

Page that info back into your memory! Virtual Memory Page that info back into your memory!

Simplifying Memory for Applications Applications should see the straightforward memory layout we are familiar with Applications should think they own all of memory Solution: We give them a virtual view of memory

Protection between Processes With a bare system, processes can assigned real physical addresses Which means that nay program can access any address (even one they don’t own) Soln: We should send all addresses through mechanism that OS controls

Mapping Virtual Memory (VM) to Physical Memory (PM) We divide into memory into equal sized chunks (about 4 KiB - 8 KiB)

Mapping Virtual Memory (VM) to Physical Memory (PM) We divide into memory into equal sized chunks (about 4 KiB - 8 KiB), AKA pages!

Mapping VM to PM Any chunk of VM can be mapped to any chunk of PM (“page”)

One Small Problem... We don’t know how large main memory is How does system know which page in VM maps to which one in PM? Use lookup table (page table) to deal with this

Paged Memory Systems Processor-generated address can be split into: A page table contains the physical page number Points to the base of each physical page Makes it possible to store pages of program non-contiguously

Address Mapping in Page Tables Page Table functionality: Incoming request is Virtual Address and we want Physical ADdress Physical Offset = Virtual Offset (since page aligned) We just need to swap the Virtual Page Number (VPN) for Physical Page Number (PPN)

Address Mapping in Page Tables Page Table Implementation Use VPN as index into PT Store PPN and management bits (Valid, Access Rights) Do NOT store data Data sits in PM

Page Table Layout

Page Table Layout

Page Table Layout

Page Table Layout

Page Table Layout

Page Table Layout

What goes inside the Page Table? Contains either PPN or an indication that it doesn’t exist in main memory Valid bit: 1 → virtual page is in physical memory 0 → OS needs to fetch page from disk Access Rights: provides protection Read, write, Executable

One Other Problem... Steps to Retrieve Data 1. Access page table for access translation (lives in PM) 2. Access correct physical address Requires two accesses of physical memory!!!! Solution: build separate cache for Page Table Called Translation Lookaside Buffer (TLB) Stores VPN → PPN Mapping translations

Cache versus TLB

Some more Info on TLB Usually small, typically 32-128 entries Access time comparable to that of cache Usually fully associative (or have high associativity)

Address Translation Using TLB

So how do we get the actual value, now that we have the address? Up to now, usually we would just go to physical memory (or if we’re lucky, just go to the cache). But now, our memory values are distributed between physical memory and disk! Remember the valid bit in the page table entries: Valid bit: 1 → virtual page is in physical memory 0 → OS needs to fetch page from disk Going to physical memory is faster than going to disk, but more expensive ($$$) than disk Solution: put currently used memory values in physical memory (smaller amount), and the rest on Disk (everything else) Sound familiar? It’s caching! Physical memory is a cache for disk! If we have to go to disk, then that’s a page fault (like a cache miss). Only having to go to physical memory is like a cache hit, but doesn’t have a cool name.

Remember caches? Physical memory is a cache for disk! Phys. Memory address Cache (shortcut for phys. memory) Cache Miss Block not in cache, have to go to memory Check the cache In the same way caches dealt in units of blocks (of N bytes), phys. memory has pages (of M > N bytes) Phys. Memory (shortcut for disk) Phys. Memory address Disk Page Fault Check phys. mem. Page not in memory, have to go to disk

Putting it all together (TLB + Cache + MEM + Disk) Address Translation: TLB Miss Phys. Memory address TLB (shortcut for page table) Page Table Virtual Memory address Addr. not in TLB, have to go to page table to translate (translates all virtual addr. in use to pages in phys. addr / disk addr.) Check the TLB TLB Hit Addr. in TLB, can immediately get phys. Addr. translation Accessing contents/value at address: Phys. Memory (shortcut for disk) Cache (shortcut for phys. memory) Phys. Memory address Disk Cache Miss Value/ Contents Page Fault Block not in cache, have to go to memory Check the cache Page not in memory, have to go to disk Wow steven these are so cool ! ! ! Cache Hit Page in phys. memory