Carnegie Mellon 1 Virtual Memory 15-213 / 18-213: Introduction to Computer Systems 10 th Recitation, October 29th, 2012 Grant Skudlarek Section G.

Slides:



Advertisements
Similar presentations
Memory Management: Overlays and Virtual Memory
Advertisements

1 CMPT 300 Introduction to Operating Systems Virtual Memory Sample Questions.
EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Carnegie Mellon 1 Virtual Memory: Concepts : Introduction to Computer Systems 15 th Lecture, Oct. 14, 2010 Instructors: Randy Bryant and Dave O’Hallaron.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Virtual Memory I Steve Ko Computer Sciences and Engineering University at Buffalo.
Recitation 7 Greg Reshko Office Hours: Wed 2:00-3:00PM March 31 st, 2003.
Carnegie Mellon 1 C Primer and Virtual Memory / : Introduction to Computer Systems 10 th Recitation, Oct. 31, 2011 Slides by: Pranav Senthilnathan.
Carnegie Mellon 1 Virtual Memory: Concepts / : Introduction to Computer Systems 16 th Lecture, Oct. 21, 2014 Instructors: Greg Ganger, Greg.
Memory Management CSE451 Andrew Whitaker. Big Picture Up till now, we’ve focused on how multiple programs share the CPU Now: how do multiple programs.
Virtual Memory: Concepts
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
Carnegie Mellon 1 Saint Louis University Virtual Memory CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant.
Carnegie Mellon /18-243: Introduction to Computer Systems Instructors: Bill Nace and Gregory Kesden (c) All Rights Reserved. All work.
1 Seoul National University Virtual Memory: Systems.
1 Virtual Memory. 2 Outline Pentium/Linux Memory System Core i7 Suggested reading: 9.6, 9.7.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
1 Recitation #9, Section F, , Sp 06 Virtual memory Reminders: Quiz today: virtual memory Shell Lab due Thursday TA: Jernej Barbic Modified from:
1 Virtual Memory: Concepts Andrew Case Slides adapted from Jinyang Li, Randy Bryant and Dave O’Hallaron.
Carnegie Mellon 1 Virtual Memory: Concepts Instructor: Rabi Mahapatra (TAMU) Slides: Randy Bryant and Dave O’Hallaron (CMU)
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
CSE 351 Virtual Memory. Agenda Today … Review on VM Example problems on VM accesses.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Memory Management: Overlays and Virtual Memory. Agenda Overview of Virtual Memory –Review material based on Computer Architecture and OS concepts Credits.
Lab4: Virtual Memory CS 3410 : Computer System Organization & Programming Spring 2015.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Virtual Memory: Concepts Slides adapted from Bryant.
Virtual Memory : Introduction to Computer Systems Recitation 10: Oct. 28, 2013 Marjorie Carlson Recitation A.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Virtual Memory: Concepts CENG331 - Computer Organization.
Virtual Memory Topics Motivations for VM Address translation Accelerating translation with TLBs CS 105 “Tour of the Black Holes of Computing!”
Carnegie Mellon Introduction to Computer Systems / Spring 2009 March 23, 2009 Virtual Memory.
Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts.
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Virtual Memory: Systems CSCE312: Computer Organization.
University of Washington Indirection in Virtual Memory 1 Each process gets its own private virtual address space Solves the previous problems Physical.
Chapter 18 Paging Chien-Chung Shen CIS/UD
1 Virtual Memory. 2 Outline Case analysis –Pentium/Linux Memory System –Core i7 Suggested reading: 9.7.
Computer Architecture Lecture 12: Virtual Memory I
Translation Lookaside Buffer
Virtual Memory Samira Khan Apr 25, 2017.
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Section 9: Virtual Memory (VM)
From Address Translation to Demand Paging
Virtual Memory: Systems
Section 9: Virtual Memory (VM)
From Address Translation to Demand Paging
Today How was the midterm review? Lab4 due today.
Virtual Memory III CSE 351 Spring 2017
Virtual Memory : Introduction to Computer Systems Recitation 10: Nov. 2, 2015 Karthic Palaniappan.
Memory Hierarchy Virtual Memory, Address Translation
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2018
CS 105 “Tour of the Black Holes of Computing!”
CSE 153 Design of Operating Systems Winter 2018
Virtual Memory: Concepts /18-213/14-513/15-513: Introduction to Computer Systems 17th Lecture, October 23, 2018.
From Address Translation to Demand Paging
Virtual Memory: Systems
Virtual Memory S04, Recitation, Section A
Virtual Memory CSCI 380: Operating Systems Lecture #7 -- Review and Lab Suggestions William Killian.
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Virtual Memory II CSE 351 Winter 2018
CSCI 380: Operating Systems William Killian
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 153 Design of Operating Systems Winter 2019
Translation Lookaside Buffers
CSE 153 Design of Operating Systems Winter 2019
Instructor: Phil Gibbons
Presentation transcript:

Carnegie Mellon 1 Virtual Memory / : Introduction to Computer Systems 10 th Recitation, October 29th, 2012 Grant Skudlarek Section G

Carnegie Mellon 2 Today Style Shell Lab Malloc Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 3 Style Style isn’t about best practice, but conformity Our style guideline is on the course website Feel free to ask us with style questions

Carnegie Mellon 4 Today Style Shell Lab Malloc Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 5 Shell Lab Due Thursday, November 1

Carnegie Mellon 6 Shell Lab Some more useful functions…  Sigsuspend()  Sleeps a process while waiting for a signal  html_node/Sigsuspend.htmlhttp:// html_node/Sigsuspend.html

Carnegie Mellon 7 Shell Lab Some more useful functions…  Tcsetpgrp()  Takes file descriptor, process group id  Shifts terminal control by fd to pgrp from calling process –Eg routing STDIN to FG job instead of shell  bc-manual-0.02/library_24.html bc-manual-0.02/library_24.html

Carnegie Mellon 8 Today Style Shell Lab Malloc Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 9 Malloc Lab Out November 1 st Due November 15 th Start early Ask questions

Carnegie Mellon 10 Today Style Shell Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 11 Malloc/pointer review Today!  6:00 pm -7:30pm  GHC 4401 (Rashid Auditorium) How and when to use malloc() The different types of pointers  What’s a char(*(*x())[])() ?

Carnegie Mellon 12 Today Style Shell Lab Malloc Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 13 Git primer Afraid of losing files but too confused/lazy to learn Git and set up an account? Make a local repository  No account required  >cd tshlab-handout >git init >git add (files) >git commit

Carnegie Mellon 14 Git primer /  Website for , Git stuco course  Lecture 2 on basic commands is particularly useful

Carnegie Mellon 15 Today Style Shell Lab Malloc Lab Malloc/pointer review Git primer Virtual Memory

Carnegie Mellon 16 Virtual Memory Abstraction Virtual memory is layer of indirection between processor and physical memory providing:  Caching  Memory treated as cache for much larger disk  Memory management  Uniform address space eases allocation, linking, and loading  Memory protection  Prevent processes from interfering with each other by setting permission bits

Carnegie Mellon 17 Virtual Memory Implementation Virtual memory implemented by combination of hardware and software  Operating system creates page tables  Page table is array of Page Table Entries (PTEs) that map virtual pages to physical pages  Hardware Memory Management Unit (MMU) performs address translation

Carnegie Mellon 18 Address Translation and Lookup On memory access (e.g., mov 0xdeadbeef, %eax)  CPU sends virtual address to MMU  MMU uses virtual address to index into in-memory page tables  Cache/memory returns PTE to MMU  MMU constructs physical address and sends to mem/cache  Cache/memory returns requested data word to CPU

Carnegie Mellon 19 Recall: Address Translation With a Page Table Virtual page number (VPN) Virtual page offset (VPO) Virtual address Physical address Valid Physical page number (PPN) Page table Page table base register (PTBR) Page table address for process Valid bit = 0: page not in memory (page fault) 0p-1pn-1 Physical page offset (PPO) 0p-1 Physical page number (PPN) pm-1

Carnegie Mellon 20 Translating with a k-level Page Table VPN 1 0p-1 n-1 VPOVPN 2...VPN k PPN 0p-1 m-1 PPOPPN VIRTUAL ADDRESS PHYSICAL ADDRESS... Level 1 page table Level 2 page table Level k page table

Carnegie Mellon 21 x86 Example Setup Page size 4KB (2^12 Bytes) Addresses: 32 bits (12 bit VPO, 20 bit VPN) Consider a one-level page table with:  Base address: 0x  4-byte PTEs  4KB aligned (i.e., lowest 12 bits are zero)  Lowest 3 bits used as permissions –Bit 0: Present? –Bit 1: Writeable? –Bit 2: UserAccessible? How big overall?  2^20 indicies, so 4MB

Carnegie Mellon 22 Example Given the setup from the previous slide, what are the VPN (index), PPO, and VPO of address: 0xdeadbeef?

Carnegie Mellon 23 Example Answers:  VPN (index) = 0xdeadb ( )  VPO = PPO = 0xeef Consider a page table entry in our example PT:  Location of PTE = base + (size * index)  0x0137ab6c = base + 4 * index  PTE: 0x  Physical address: 0x98765eef

Carnegie Mellon 24

Carnegie Mellon 25

Carnegie Mellon 26 Questions?