1 Pintos Virtual Memory Management Project (CS3204 Spring 2006 VT) Yi Ma.

Slides:



Advertisements
Similar presentations
Project 5: Virtual Memory
Advertisements

CS 140 Project 3 Virtual Memory
Part IV: Memory Management
CS 4284 Systems Capstone Godmar Back Virtual Memory – Paging Techniques.
1 Pintos Project #3 Virtual Memory The following slides were created by Xiaomo Liu and others for CS 3204 Fall And Modified by Nick Ryan for Spring.
Copyright ©: Lawrence Angrave, Vikram Adve, Caccamo 1 Virtual Memory III.
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
CS 153 Design of Operating Systems Spring 2015
Jaishankar Sundararaman
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
Lecture 11: Memory Management
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Memory Management 2010.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
Operating Systems ECE344 Ding Yuan Paging Lecture 8: Paging.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
CS 3204 Operating Systems Godmar Back Lecture 15.
Computer Studies (AL) Memory Management Virtual Memory I.
CS 4284 Systems Capstone Godmar Back Virtual Memory – Paging Techniques.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Virtual Memory 1 1.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 9: Virtual Memory.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Processes and Virtual Memory
Operating Systems Lesson 5. Plan Memory Management ◦ Memory segments types ◦ Processes & Memory ◦ Virtual Memory ◦ Virtual Memory Management ◦ Swap File.
CS 3204 Operating Systems Godmar Back Lecture 17.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Implementation.
Pintos project 3: Virtual Memory Management
CS 3204 Operating Systems Godmar Back Lecture 16.
Lecture 14 PA2. Lab 2: Demand Paging Implement the following syscalls xmmap, xmunmap, vcreate, vgetmem/vfreemem, srpolicy Deadline: November , 10:00.
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)
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
1 Virtual Memory. 2 Outline Case analysis –Pentium/Linux Memory System –Core i7 Suggested reading: 9.7.
Virtual Memory – Paging Techniques
Virtual Memory What if program is bigger than available memory?
Lecture 11 Virtual Memory
Virtual Memory CSSE 332 Operating Systems
CS161 – Design and Architecture of Computer
CSE 120 Principles of Operating
Memory Caches & TLB Virtual Memory
Chapter 9: Virtual Memory
Modeling Page Replacement Algorithms
CSE 153 Design of Operating Systems Winter 2018
CSE 153 Design of Operating Systems Winter 2018
Chapter 9: Virtual-Memory Management
Making Virtual Memory Real: The Linux-x86-64 way
Page Replacement.
Module IV Memory Organization.
CS399 New Beginnings Jonathan Walpole.
Modeling Page Replacement Algorithms
CSE 451: Operating Systems Autumn 2005 Memory Management
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
CSE 153 Design of Operating Systems Winter 2019
CSE 153 Design of Operating Systems Winter 2019
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.
COMP755 Advanced Operating Systems
Clock Algorithm Example
Virtual Memory 1 1.
Presentation transcript:

1 Pintos Virtual Memory Management Project (CS3204 Spring 2006 VT) Yi Ma

2 Outline Memory and Access Current Status in Pintos Requirements Suggestion

3 Memory Executable on Disk Virtual Linear Address Space Physical Memory (RAM+ROM) User executable uses virtual, relative address (0-3GB). They are organized as segments. In project 2, loader installs user executable into physical RAM. Virtual, relative are translated into absolute, physical address by MMU and paging. It manages the RAM so that multiple process shares RAM without interrupting each other. However in lazy load you don’t have to load code and data at first.

4 Virtual Memory Management MMU translating linear address into page and offset Find these in mmu.h and pagedir.h/c for its interface. Virtual Memory Management Virtual Address Space RAM Frames

5 Current Status (after a successful project2) Kernel’s memory has been well handled. MMU—PD, PT, pagedir—address maps. Per-process page table (process.c). Preload data and code segment and stack (load, load_segment, and setup stack). Fixed stack and limited size and number of programs.

6 Requirement Overview Page Table Management Address mapping and page fault Swapping Choose a replacement alg., like a 1-bit clock alg. (NRU) Lazy loading Load on demand Memory mapped files

7 Page Table Management Functionalities Virtual mapped to physical Locate page (RAM or SWAP) Physical back to virtual (evicting) This vs. PD & PT? Virtual vs. Physical Page Install virtual page into a physical frame Mapping through MMU’s PD and PT Keep track

8 Page Fault Pre-project 3 Install new PD when switching Setup all mapping Fault on unmapped address and kill Post-project 3 Page_fault is no longer always an error May have to swap in or load How Get the faulting address Find the page (file or swap) Let it in (may require eviction of other page currently located in the frame.) Update PTE

9 Address Translation Process Virtual Address Page Table Walk Check Permissions Physical Address Page Fault Exception “Protection Fault” Page Fault Exception “Page Not Present” Terminate Process misshit restart instruction okdenied Load Page done in hardware done in OS software done in software or hardware Swapping Free Page Available

10 Confusing? Too many pages and tables? MMU: pde, pte Frame page Virtual page Swapped page Their cross links

11 Frames Only user pool ram_pages in load.s and init.c? It’s relation with current palloc. Two ways for your frame allocator. Where you initialize.

12 Virtual Pages It is the core of the virtual memory. Relation with user address space. (continuous or not) Relation with frames Relation with swap disk Relation with executable file Relation with MMU’s PD and PT

13 Pages on disk Memory in 4KB pages Disk in 512B sectors How to organize the swap disk so that it could best conform page system Design data structure to implement the above design

14 What is the problem Starting/end address of a page Permission of the page Location of the “virtual” page: RAM, SWAP, or File Keep track: when and what to update

15 Stack Growth First page allocated in setup_stack Look at memory layout: there is a vacant between heap and stack i386 “push” at most 32B to the stack at once Stack is growing downwards Catch the stack pointer—esp When: page_fault Limit the size of stack reasonably

16 Swapping Loaded pages got evicted—swap out Evicted pages got reloaded—swap in Swap out on page fault and no free frame Swap in on page fault Manage Disk (track occupied or free sectors) No order Parallel

17 Evict a page Keep track where is the free frames Keep track who are evict-able frames Pick a replacement algorithm like 1-bit alg. Accessed/dirty bit in PTE Send it to swap Update PD & PT

18 Lazy Loading Now: load all loadable pages into RAM Lazy: load these only when needed Not swapping, use the executable file Keep track the location

19 Memory mapped files Keep a copy of an open file in memory Keep it in continuous virtual pages File size is not multiple of PGSIZE—stick-out, cause partial page Mapped IDs Don’t map when: zero address or length, overlap, or console Address or pages are “virtual” System calls: mmap(fd, addr), munmap(ID)

20 On process termination Clean you page table Free your frames Free your SWAP Close all files

21 Other issues Access user data In project 2, need only verify user address In project 3, need handle actual access to the content of user memory Need protect: check address, lock frame, read/write, and unlock. Synchronization Allow parallelism of multiple processes Page fault form multiple processes E.g., A’s page fault need I/O (swap, lazy load); B’s page fault need not, then B should go ahead; Containers Proper container will affect your design significantly Bit map, hash, list, and array How many copies? Make it simple

22 Suggested Order Frame table management: your own “palloc”—modify or design new Switch to your allocator—modify process.c Virtual page table management Page Fault Stack growth, mmap, and reclamation Swap: accessed/dirty bits, alias, parallelism, and eviction algorithm wmcquain/index.html

23 Other suggestions Go over your lecture notes Design before start Keep an eye on Dr. Back’s project pages