Ch7d- 2 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Individual Space Every process wants its own space Ideally, it would like.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Memory Management (II)
Operating System Support Focus on Architecture
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
Translation Buffers (TLB’s)
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 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
Computer Organization and Architecture
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
EECS 370 Discussion 1 SMBC. EECS 370 Discussion Exam 2 Solutions posted online Will be returned in next discussion (12/9) – Grades hopefully up on CTools.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Review of Memory Management, Virtual Memory CS448.
Address Translation Mechanism of 80386
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
Some VM Complications Extra memory accesses Page tables are huge
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
IT253: Computer Organization
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Chapter 4 Memory Management Virtual Memory.
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
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.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Lab4: Virtual Memory CS 3410 : Computer System Organization & Programming Spring 2015.
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)
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
Memory Management – Page 1CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management *** Modified – look for Reading:
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
CS203 – Advanced Computer Architecture Virtual Memory.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
CMSC 611: Advanced Computer Architecture
Lecture 11 Virtual Memory
Virtual Memory So, how is this possible?
ECE232: Hardware Organization and Design
CS161 – Design and Architecture of Computer
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Virtual Memory User memory model so far:
Section 9: Virtual Memory (VM)
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
Lecture 28: Virtual Memory-Address Translation
CSCI206 - Computer Organization & Programming
Page Replacement.
Page that info back into your memory!
Lecture 29: Virtual Memory-Address Translation
Chapter 9: Virtual Memory
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Translation Buffers (TLB’s)
TLB Performance Seung Ki Lee.
© 2004 Ed Lazowska & Hank Levy
Translation Buffers (TLB’s)
Translation Buffers (TLBs)
Operating Systems: Internals and Design Principles, 6/E
Review What are the advantages/disadvantages of pages versus segments?
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Ch7d- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Individual Space Every process wants its own space Ideally, it would like the entire computer to itself Sharing the computer’s memory creates problems Sometimes a program will be at location 4000, sometimes at location , etc. 7.4 Use Virtual Memory to fool each process to thinking that it starts at location 0 CPU uses virtual addresses - Start the program at virtual page 0, even if it’s not physical page 0 Each process must have an individual page table to make this work Every virtual page 0 must point to a different physical page, and so on

Ch7d- 3 EE/CS/CPE Computer Organization  Seattle Pacific University Example VPNValidPPN/ (index)BitDisk address sector sector 4323… sector Page Table for process A: VPNValidPPN/ (index)BitDisk address sector sector sector Page Table for process B: 7.4 Virtual page (process A) points to physical page Virtual page (process B) points to physical page The processes both can start at location , but have different data. Note: Physical page 1100 is shared.

Ch7d- 4 EE/CS/CPE Computer Organization  Seattle Pacific University Protection Using Virtual Memory 7.4 We want to protect different processes from each other Can’t read or write to any other process’s memory, unless specifically allowed Providing separate page tables fixes this problem Each process can only access pages through its page table As long as the page table doesn’t point to pages belonging to other processes, no problem Since only the OS can write the page tables, the system is safe

Ch7d- 5 EE/CS/CPE Computer Organization  Seattle Pacific University Protection Example VPNValidPPN/ (index)BitDisk address sector sector 4323… sector Page Table for process A: VPNValidPPN/ (index)BitDisk address sector sector sector Page Table for process B: 7.4 How can process A access process B’s V.P ? Note: Since physical page 1100 is shared, protection is violated. None of process A’s V.P. point to Physical page Impossible to to access it!

Ch7d- 6 EE/CS/CPE Computer Organization  Seattle Pacific University Shooting Ourselves in the Foot 7.4 Virtual Memory Access Look up page number in page table Access memory Each memory access becomes two accesses Even for addresses stored in the cache Solution: Cache the page table entries in a special cache The Translation Lookaside Buffer (TLB) is just a cache that holds recently accessed page table entries A TLB hit means that we don’t have to actually look in the page table

Ch7d- 7 EE/CS/CPE Computer Organization  Seattle Pacific University TLB Design 7.4 We want the TLB to have a high hit rate Fortunately, pages are huge, providing super-high locality TLB usually only has a small number of entries (i.e. 64) and is fully-associative Typical hit rates are 98.0 to 99.9% The TLB should store anything needed from the page table Physical page number Valid bit, Dirty bit Warning: TLB can violate protection after a process switch Flush the TLB on each process switch

Ch7d- 8 EE/CS/CPE Computer Organization  Seattle Pacific University Virtual Memory Benefits 7.4 Virtual Memory frees the programmer from many issues Large programs can run in smaller systems It doesn’t matter what else is running on the system, all programs start at a virtual address of zero and can access the entire address space Virtual memory protects different processes from each other

Ch7d- 9 EE/CS/CPE Computer Organization  Seattle Pacific University Evidence of Virtual Memory at Work 7.4 Thrashing If a program is just too big, it will constantly page fault to read in new pages (and throw out ones it needs) Paging Out If a program has been sitting idle for a long time, it is likely that it will be completely paged out to disk When you return to the program, it will start out slow as it pages all of the memory back in Loading Bringing in a new program may require writing pages for an old one out to disk