4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.

Slides:



Advertisements
Similar presentations
Page Table Implementation
Advertisements

Paging 1 CS502 Spring 2006 Paging CS-502 Operating Systems.
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
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.
OS Spring ‘04 Paging and Virtual Memory Operating Systems Spring 2004.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Memory Management (II)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Paging and Virtual Memory. Memory management: Review  Fixed partitioning, dynamic partitioning  Problems Internal/external fragmentation A process can.
Translation Buffers (TLB’s)
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.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Mem. Hier. CSE 471 Aut 011 Evolution in Memory Management Techniques In early days, single program run on the whole machine –Used all the memory available.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
Operating Systems Chapter 8
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: 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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
IT253: Computer Organization
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
© 2004, D. J. Foreman 1 Virtual Memory. © 2004, D. J. Foreman 2 Objectives  Avoid copy/restore entire address space  Avoid unusable holes in memory.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Virtual Memory 1 1.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
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.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Page Table Implementation. Readings r Silbershatz et al:
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Paging Logical address space of a process can be noncontiguous; process is allocated.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
Operating Systems, Winter Semester 2011 Practical Session 9, Memory 1.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
COMP 3500 Introduction to Operating Systems Paging: Basic Method Dr. Xiao Qin Auburn University Slides.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
CS161 – Design and Architecture of Computer
Memory: Page Table Structure
Translation Lookaside Buffer
Computer Organization
Memory Management Virtual Memory.
CS161 – Design and Architecture of Computer
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Page Table Implementation
CS510 Operating System Foundations
Paging and Segmentation
Lecture 28: Virtual Memory-Address Translation
CSCI206 - Computer Organization & Programming
Lecture 29: Virtual Memory-Address Translation
Translation Lookaside Buffer
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
So far in memory management…
Practical Session 9, Memory
Translation Buffers (TLB’s)
Translation Buffers (TLB’s)
Computer Architecture
Translation Buffers (TLBs)
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

4.3 Virtual Memory

Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces OS move pieces in and out from disk  Virtual memory – OS automates overlays  Virtual addresses vs. physical addresses

CPU MMU translates virtual addresses to physical addresses

Memory unit = page ge is not currently in memory. X indicates that the page is not currently in memory.

Mapping virtual to physical addresses  Done in hardware for speed.  Virtual address = page number and offset within page  Each process has its own page table. can be quite large  physical address = pageTable[pageNumber] + offset must be fast  Page fault occurs when a page is not in memory and is referenced.

Ex. 32 bit virtual address space  Given 32 bit virtual address space.  Given 2 12 =4096 byte pages.  How many pages? 1 million!

Ex. Page table  Page table size = 2 4  Page size = 2 12

Multilevel page tables

Example page table entry  Caching disabled bit = use device, not cache) (used for memory mapped I/O)  Referenced = used bit  Modified = “dirty” bit  Protection = R W X access flags  Present = in memory flag  Page frame number

TLBs – translation lookaside buffers  Problem: Page tables are large and are therefore kept in main memory. This impacts performance. Consider an instruction that moves data from one register to another.  W/out paging, this makes only one memory reference (to fetch the instruction).  W/ paging, additional memory references are required to access the page table.  Solution: “cache” frequently used page table entries

TLBs – translation lookaside buffers  Problem: Page tables are large and are therefore kept in main memory.  Solution: “cache” frequently used page table entries  This is effective because most programs make a large number of references to a small number of pages.

TLBs – translation lookaside buffers  a.k.a. associative memory Lookup/search occurs in parallel in hardware  8 to 64 entries  “cache” of frequently used page table entries

Inverted page tables  Problem: Using virtual to physical page tables:  Indexed by virtual page number.  Over 1 million entries for 4K pages on a 32 bit system! (2 32 /2 12 )  Over 30 million gigabytes on a 64 bit system!  But our 64 bit system may only 256M RAM!

Inverted page tables  Problem: Using virtual to physical page tables.  Solution: Use one entry per physical page (rather then one entry per virtual page)  Ex. A 64 bit system with 256M RAM and 4K pages requires an inverted page table with only 64K entries. (2 28 /2 12 =2 16 )  But search for virtual to physical translation becomes hard (slow)! Why?

Inverted page tables  Problem: Using virtual to physical page tables.  Solution: Use one entry per physical page (rather then one entry per virtual page)  But search for virtual to physical translation becomes hard (slow)! Why?  Because every time process p references virtual page p, we must search the IPT for an entry (n,p) for every memory reference – not just the page faults!  Solution:  Use TLB and hash table

Inverted page tables  Problem: Using virtual to physical page tables.  Solution: Use one entry per physical page (rather then one entry per virtual page)  But search for virtual to physical translation becomes hard (slow)!  Solution:  Use TLB for heavily used pages and a hash table for TLB misses.

Page table vs. inverted page table