Virtual Memory Main Memory Magnetic Disk Upper level Lower level.

Slides:



Advertisements
Similar presentations
1 Memory hierarchy and paging Electronic Computers M.
Advertisements

Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
1 Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
Chapter 7 Large and Fast: Exploiting Memory Hierarchy Bo Cheng.
The Memory Hierarchy II CPSC 321 Andreas Klappenecker.
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy (Part II)
EECE476: Computer Architecture Lecture 27: Virtual Memory, TLBs, and Caches Chapter 7 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
VIRTUAL MEMORY. Virtual memory technique is used to extents the size of physical memory When a program does not completely fit into the main memory, it.
Lecture 33: Chapter 5 Today’s topic –Cache Replacement Algorithms –Multi-level Caches –Virtual Memories 1.
Operating Systems Chapter 8
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
IT253: Computer Organization
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
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.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
1  1998 Morgan Kaufmann Publishers Recap: Memory Hierarchy of a Modern Computer System By taking advantage of the principle of locality: –Present the.
Review (1/2) °Caches are NOT mandatory: Processor performs arithmetic Memory stores data Caches simply make data transfers go faster °Each level of memory.
Operating Systems Unit 7: – Virtual Memory organization Operating Systems.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
Memory Hierarchy How to improve memory access. Outline Locality Structure of memory hierarchy Cache Virtual memory.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
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”
Operating Systems Session 7: – Virtual Memory organization Operating Systems.
1 Chapter Seven. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4 to 6 transistors) DRAM: –value.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
A PRESENTATION ON VIRTUAL MEMORY (PAGING) Submitted to Submitted by Prof. Dr. Ashwani kumar Ritesh verma Dept. Of Physics Mtech (Instrumentation) Roll.
Virtual Memory Chapter 8.
CMSC 611: Advanced Computer Architecture
Translation Lookaside Buffer
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Memory Management Virtual Memory.
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
Lecture 12 Virtual Memory.
Section 9: Virtual Memory (VM)
CS703 - Advanced Operating Systems
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.
Morgan Kaufmann Publishers
Virtual Memory Chapter 8.
CSCI206 - Computer Organization & Programming
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
CMSC 611: Advanced Computer Architecture
Virtual Memory 4 classes to go! Today: Virtual Memory.
ECE 445 – Computer Organization
CMSC 611: Advanced Computer Architecture
Translation Buffers (TLB’s)
Contents Memory types & memory hierarchy Virtual memory (VM)
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
Chapter Five Large and Fast: Exploiting Memory Hierarchy
Translation Buffers (TLBs)
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.
Virtual Memory.
Review What are the advantages/disadvantages of pages versus segments?
Virtual Memory 1 1.
Presentation transcript:

Virtual Memory Main Memory Magnetic Disk Upper level Lower level

Objective Main memory acts as a “cache” for the magnetic disk memory can be shared between several programs (and users) allows programs access to much greater “memory” than would otherwise be possible transparent to programs

Unique Address Space Need common set of addresses applicable for an entire program this is called the program address space Usable only by this particular program and no others Common addressing mechanism for both items stored in main memory and items stored on disk.

Terminology Physical address - the address of an item in main memory Virtual address - the address of an item in the virtual address space of a program, that can be translated to a physical address. There are many more virtual addresses than physical addresses, so that not all virtual addresses can simultaneously refer to real addresses in main memory.

More terminology A page (cf. “block”) is a large contiguous sequence of virtual memory addresses. A page fault (“miss”) occurs when a virtual address is referenced that does not correspond to a physical address. virtual addresses physical addresses disk locations

Page Faults Page faults are extremely costly taking 100,000s of times longer than a direct memory access Therefore minimisation of the probability of a page fault is a vital goal in memory hierarchy design Whereas the cache miss rate is normally between 0.1% to 20% the page fault rate is between % to %.

Minimising Page Faults Use large page sizes (4MB to 64MB) Allow flexible placement of pages in main memory Use “smart” complex algorithms to place pages in memory Reduce the number of writes to disk.

Virtual Address Structure of a virtual memory address: page offsetvirtual page number page offsetphysical page number mapping k bits n bits m bits m < n Number of physical pages = 2 m Page size = 2 k bytes

Virtual to Physical Mapping A virtual page can be mapped to any physical page This is a fully associative mapping: Contrast this with direct mapping used between cache and main memory, where each memory address corresponds to one fixed address in the cache. Each program maintains a corresponding page table for this map.

Page Table Stored in Memory page offsetvirtual page number Virtual address: n bits k bits 1 page offsetphysical page number m (< n) bits Valid There is an entry for every virtual address. Page Table Register

Handling Page Faults Alongside the page table there is a data structure that records where pages are located on disk. On a page fault this is used to write the page from disk to main memory. If all pages in main memory are already used, then a “least recently used” strategy is adopted to decide which page in physical memory should be dumped to make room for the new one.

Multiple Processes The state of a program (program A) is completely determined by its state table, the PC and the registers. Another program (B) can use the CPU provided that the state of the current program is saved. Program A can be reactivated when the OS reloads A’s state, and continues execution.

Protecting Address Spaces It is vital that the address spaces of different programs be kept completely separate. Only the OS should have the right to access any program’s address space. A program must not change its own page table. The hardware must support “user processes” and “executive processes” Only the latter have freedom to change page tables.

Behaviour of Memory Hierachies Compulsory Misses: first access to the page (block) results in a fault (miss). so increase page (block) size Capacity misses: memory (cache) cannot contain all virtual addresses (main memory). so increase size of memory (cache) Collision misses: direct mapping causes several pages (blocks) to be mapped to one physical page (cache index). so use fully associative mapping.

The Gap Processor speed doubles every two years. Memory density increases by fourfold every three years. Speed of access to memory (DRAM) increases only linearly. Multi-level caching systems help to solve this problem.