Malloc & VM By sseshadr. Agenda Administration – Process lab code will be inked by Thursday (pick up in ECE hub) – Malloc due soon (Thursday, November.

Slides:



Advertisements
Similar presentations
Memory Management: Overlays and Virtual Memory
Advertisements

Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
1 A Real Problem  What if you wanted to run a program that needs more memory than you have?
1 Memory Systems Virtual Memory Lecture 25 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
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.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Principle Behind Hierarchical Storage  Each level memorizes values stored at lower levels  Instead of paying the full latency for the “furthermost” level.
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.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
Computer Architecture Lecture 28 Fasih ur Rehman.
CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)
Lecture 19: Virtual Memory
1 Seoul National University Virtual Memory: Systems.
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
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.
Virtual Memory. DRAM as cache What about programs larger than DRAM? When we run multiple programs, all must fit in DRAM! Add another larger, slower level.
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.
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)
Malloc & VM By sseshadr. Agenda Administration – Process lab code will be inked by Thursday (pick up in ECE hub) – Malloc due soon (Thursday, November.
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?
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Virtual Memory.  Next in memory hierarchy  Motivations:  to remove programming burdens of a small, limited amount of main memory  to allow efficient.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Virtual Memory: Concepts Slides adapted from Bryant.
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)
1 Lecture: Virtual Memory, DRAM Main Memory Topics: virtual memory, TLB/cache access, DRAM intro (Sections 2.2)
University of Washington Indirection in Virtual Memory 1 Each process gets its own private virtual address space Solves the previous problems Physical.
Translation Lookaside Buffer
Lecture 11 Virtual Memory
Vivek Seshadri 15740/18740 Computer Architecture
Improving Memory Access The Cache and Virtual Memory
Virtual Memory Chapter 7.4.
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:
CS703 - Advanced Operating 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
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
CS510 Operating System Foundations
CSCI206 - Computer Organization & Programming
From Address Translation to Demand Paging
CS 105 “Tour of the Black Holes of Computing!”
Virtual Memory S04, Recitation, Section A
FIGURE 12-1 Memory Hierarchy
Page that info back into your memory!
Virtual Memory CSCI 380: Operating Systems Lecture #7 -- Review and Lab Suggestions William Killian.
Translation Lookaside Buffer
CSE 351: The Hardware/Software Interface
Virtual Memory Nov 27, 2007 Slide Source:
CSE451 Virtual Memory Paging Autumn 2002
Virtual Memory Prof. Eric Rotenberg
CS 105 “Tour of the Black Holes of Computing!”
CSCI 380: Operating Systems William Killian
CS 105 “Tour of the Black Holes of Computing!”
Paging and Segmentation
CS703 - Advanced Operating Systems
Cache writes and examples
4.3 Virtual Memory.
Instructor: Phil Gibbons
Presentation transcript:

Malloc & VM By sseshadr

Agenda Administration – Process lab code will be inked by Thursday (pick up in ECE hub) – Malloc due soon (Thursday, November 4 th ) – Exam 2 in a week (Tuesday, November 9 th ) – Proxy Lab out in a week (Tuesday, November 9 th ) Plan for today – Finish malloc questions – mm_checkheap – VM

Malloc Questions?

mm_checkheap More for YOU than for US. – But we’ll grade it. Checks consistency of data structure – (Doubly) linked lists are pointed correctly? – Headers and footers match up? – No allocated blocks in your explicit list? – No free blocks NOT in your explicit list? – Any of YOUR OWN invariants! (address-ordering?) – Seg lists: no big chunks in small lists / vice versa?

Virtual Memory

Basic Concepts

Assumptions – n-bit virtual address – m-bit physical address – P = 2 p = Page size How big is… – The virtual page number? – The physical page number? – The virtual page offset? – The physical page offset?

Basic Concepts Assumptions – n-bit virtual address – m-bit physical address – P = 2 p = Page size How big is… – The virtual page number?(n-p) bits – The physical page number?(m-p) bits – The virtual page offset?p bits – The physical page offset?p bits

Basic Concepts Anatomy of addresses (using 14-bit VA, 12-bit PA, 64 byte page size) – The VPN needs to have enough information so that the TLB can look up a PPN for it. – The PPN needs to have enough information so that the cache can look up the DATA at the given address.

Basic Concepts These addresses are stored as Page Table Entries in a Page Table. – Just a listing of conversions from VPN -> PPN And whether it’s valid Since memory translations happen very often, modern architectures speed this up with a TLB.

Basic Concepts Translation Lookaside Buffer – Hardware! – Is like a cache from VPNs to PPNs – During a translation, ask the TLB first by giving it an INDEX and TAG How big is… – The index? – The tag?

TLB Translation Lookaside Buffer – Hardware! – Is like a cache from VPNs to PPNs – During a translation, ask the TLB first by giving it an INDEX and TAG How big is… – The index?log 2 (# of sets) – The tag?(n - p - index_size)

TLB TLB Hit – Got away with the shortcut! TLB Miss – Not necessarily a page fault! – Go check the page table, and then come back and fill in the missing spot in TLB. TLB Miss and not in the page table – Page fault. What does the OS do? Make some mappings? Throw a SIGSEGV? Kill the process?

Virtual Address Anatomy TLB has 4 sets, 14-bit VA, 64 byte pages

Physical Address Anatomy Direct-mapped cache has 16 lines, each block has 4-bytes. 12-bit PA, 64 byte pages

Translation! End-to-end translation in the book from pages 794 to 798

Practice! Lots of VM questions in past Exam 2s – Means you’re likely to see one on this test!