Virtual Memory Art Munson CS614 Presentation February 10, 2004.

Slides:



Advertisements
Similar presentations
Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
Advertisements

Department of Computer Science iGPU: Exception Support and Speculative Execution on GPUs Jaikrishnan Menon, Marc de Kruijf Karthikeyan Sankaralingam Vertical.
G Robert Grimm New York University Virtual Memory.
MACHINE-INDEPENDENT VIRTUAL MEMORY MANAGEMENT FOR PAGED UNIPROCESSOR AND MULTIPROCESSOR ARCHITECTURES R. Rashid, A. Tevanian, M. Young, D. Golub, R. Baron,
Virtual Memory Primitives for User Programs Andrew W. Appel and Kai Li Presented by Phil Howard.
CS 443 Advanced OS Fabián E. Bustamante, Spring 2005 Virtual Memory Primitives for User Programs Andrew Appel and Kai Li Princeton U. Appears in ASPLOS.
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
1 A Real Problem  What if you wanted to run a program that needs more memory than you have?
CS 153 Design of Operating Systems Spring 2015
Misc Exercise 2 updated with Part III.  Due on next Tuesday 12:30pm. Project 2 (Suggestion)  Write a small test for each call.  Start from file system.
G Robert Grimm New York University Cool Pet Tricks with… …Virtual Memory.
Virtual Memory Primitives for User Programs Andrew W. Appel and Kai Li Presented by: Khanh Nguyen.
Virtual Memory Virtual Memory Management in Mach Labels and Event Processes in Asbestos Ingar Arntzen.
Computer ArchitectureFall 2008 © November 10, 2007 Nael Abu-Ghazaleh Lecture 23 Virtual.
By: Richard Rashid, Avadis Tevanian, Michael Young, David Golub, Robert Baronn, David Black, William Bolosky, and Jonathan Chew, October 1987 Presented.
Computer ArchitectureFall 2007 © November 21, 2007 Karem A. Sakallah Lecture 23 Virtual Memory (2) CS : Computer Architecture.
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.
Solution to the Gaming Parlor Programming Project.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
Address Translation.
CS533 Concepts of Operating Systems Class 14 Extensible Virtual Memory Management.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS Design.
CS533 - Concepts of Operating Systems Virtual Memory Primitives for User Programs Presentation by David Florey.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
1 Virtual Memory and Address Translation. 2 Review Program addresses are virtual addresses.  Relative offset of program regions can not change during.
Chapter 4 Memory Management Virtual Memory.
Supporting Multi-Processors Bernard Wong February 17, 2003.
The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy.
A summary by Nick Rayner for PSU CS533, Spring 2006
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
CS533 - Concepts of Operating Systems 1 The Mach System Presented by Catherine Vilhauer.
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?
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Hardware.
1 Machine-Independent Virtual Memory Management of Paged Uniprocessor and Multiprocessor Architectures by Rashid, Tevanian, Young, Golub, Baron, Black,
Paging (continued) & Caching CS-3013 A-term Paging (continued) & Caching CS-3013 Operating Systems A-term 2008 (Slides include materials from Modern.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Processes and Virtual Memory
Running Commodity Operating Systems on Scalable Multiprocessors Edouard Bugnion, Scott Devine and Mendel Rosenblum Presentation by Mark Smith.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
MODERN OPERATING SYSTEMS Third Edition ANDREW S
CSE 120 Principles of Operating
Modeling Page Replacement Algorithms
Memory Hierarchy Virtual Memory, Address Translation
Introduction to Operating Systems
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Modeling Page Replacement Algorithms
Virtual Memory Hardware
Translation Lookaside Buffer
CSE 451: Operating Systems Autumn 2005 Memory Management
Translation Buffers (TLB’s)
Virtual Memory Overcoming main memory size limitation
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Lecture 7: Flexible Address Translation
CSE 471 Autumn 1998 Virtual memory
CS533 Concepts of Operating Systems Class 14
CSE 542: Operating Systems
Review What are the advantages/disadvantages of pages versus segments?
Presentation transcript:

Virtual Memory Art Munson CS614 Presentation February 10, 2004

VM Review 0164 Physical Memory Virtual Memory (seen by application) Efficient Translation?

VM Review (II) 0164 Physical Memory Virtual Memory (seen by application) Virt. Page Phys. Frame …… 6Fr 2 1Fr 3 TLB Page Table Lookup page Found ? No Yes

VM Pros/Cons More address space –Per program –System-wide Isolation / Protection Ease of Cleanup Complicates sharing memory Performance: –Context switches (cache, TLB) Motivation: multiple interactive programs on one computer

Mach Goals Portable: uniproc, multiproc, and distributed computers Support large, sparse virtual address space Copy-on-write as VM operation Efficient copy-on-write & read-write memory sharing

Mach Goals (cont’d) Memory mapped files Allow generic user-provided backing store objects (and pagers)

Mach Memory Architecture CPUPhys. Memorypmap Machine Dependent Code RW/C R/CRW/N X/S Ref: 3Ref: 1 Kernel Address map Memory objects Pagers ??

Key Architecture Decisions Memory Objects Data. Anywhere. Associated pager maps to address space(s). Message Passing Loosely coupled, allowing generality. Simple semantics allows consistent API for distributed computing. Too simple?

Implementing Memory Sharing Shadow objects: proxies to support copy-on-write at page granularity. Shared mapping: provides coherency for read-write sharing AB C

Page Table Tradeoffs Normal: due to large size (8MB), linear organization non- option Pg 0Fr 2 Pg 1Fr 0 Pg 2Disk …… Pg 0Fr 2 Pg 1Fr 0 Pg 2Disk …… Pg 0-3 Pg 3-6 … Inverted: query with hash function. Aliasing clumsy / expensive Fr 0Pg 1 Fr 1empty Fr 2Pg 0 Fr 3Pg 6

Mach VM Performance

Mach VM Performance (II)

Clever VM Hacks Idea: use page fault hardware to check simple application predicates. OS provides hooks for application: TRAP, PROT1, PROTN, UNPROT, DIRTY, MAP2 Implicit assumption that faulting page is in memory---i.e. app handles protection faults.

Pointer Forwarding From-space To-space

Pointer Forwarding (II) From-space To-space

Hack #1: Concurrent Garbage Collection From-space To-space 1.Initialize collecting: a.Stop mutator threads. b.PROTN collection region. c.MAP2 region so collector can access (not shown). d.Copy roots & registers to to-space. e.Restart mutator threads. f.Collecting thread starts scanning from-space.

Hack #1: Concurrent Garbage Collection (II) From-space To-space Page fault void trap_fault(pg) { objList = scanPage(pg); foreach (o in objList) { copy o to to-space forward ptrs to o } UNPROT(pg); rerun faulting instr. }

Hack #2: Shared Virtual Memory

Hack #2: Shared Virtual Memory (II) CPU 1 CPU 5 aBcdefgh ijkBmfwh Give me up-to-date copy of B; Then invalidate the page. Here you go. CPU 1 now marks B as writeable and resumes execution. CPU 1 faults when trying to write read-only B.

Hack #3: Concurrent Checkpointing Goal: save application state (registers + memory). Algorithm: Mark all pages read-only ( PROTN ). Background thread concurrently copies pages to checkpoint, then marks read/write. On write-fault, checkpoint thread backs up faulting page and marks writeable.

Other VM Algorithms Generational garbage collection Persistent stores Extending address space in persistent stores Data compression paging Heap overflow detection

VM Primitive Performance

Is this a good idea? View 1: Extending VM services provided by OS Reduces instruction count => better perf* Data properties determine program execution. Mach model easy logical fit. So OS designers should improve efficiency of VM primitives.

Is this a good idea? (II) View 2: Relies on knowledge of hardware, not an abstraction. Introducing more page faults might degrade performance on current highly pipelined processors. Able to enforce not looking at CPU state? OS: trust application code?

Summary Rich set of memory abstractions enables VM for uniproc and multiproc computers. –Distributed computing tolerant of abstraction in practice? Clever VM hacks may not adjust well to hardware changes.