Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.

Slides:



Advertisements
Similar presentations
Segmentation and Paging Considerations
Advertisements

Virtual Memory Management
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Memory Management (II)
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
Multiprocessing Memory Management
Memory Management 2010.
Virtual Memory Chapter 8.
Chapter 3.2 : Virtual Memory
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Virtual Memory Deung young, Moon ELEC 5200/6200 Computer Architecture and Design Lectured by Dr. V. Agrawal Lectured by Dr. V.
Virtual Memory BY JEMINI ISLAM. What is Virtual Memory Virtual memory is a memory management system that gives a computer the appearance of having more.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
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.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
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. 
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Review of Memory Management, Virtual Memory CS448.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally MEMORYMANAGEMNT.
Operating Systems Chapter 8
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
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.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes 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.
Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
Chapter 4 Memory Management Virtual Memory.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 9: Virtual Memory.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Virtual Memory From course notes University of Waikato. Some material by Tony McGregor Other material from: The Architecture.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Memory Management Chapter 5 Advanced Operating System.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Virtual Memory Chapter 8.
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Computer Organization
Virtual memory.
Virtual Memory CSSE 332 Operating Systems
Chapter 2 Memory and process management
Chapter 9: Virtual Memory
Swapping Segmented paging allows us to have non-contiguous allocations
CSI 400/500 Operating Systems Spring 2009
Virtual Memory Chapter 8.
O.S Lecture 13 Virtual Memory.
Computer Architecture
Module IV Memory Organization.
Chapter 9: Virtual Memory
Virtual Memory Overcoming main memory size limitation
Contents Memory types & memory hierarchy Virtual memory (VM)
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Virtual Memory 1 1.
Presentation transcript:

Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001

What is Virtual Memory Swaps data in and out of physical memory. Make physical memory appear to the CPU that there is more physical memory than is actually present.

The three main reasons for using Virtual Memory 1. To free programmers from the need to carry out storage allocation and to permit efficient sharing of memory space among different users. 2. To make programs independent of the configuration and capacity of the memory systems used during their execution. 3. To achieve the high access rates and low cost Per bit that is possible with a memory hierarchy.

What does Virtual Memory really do? Virtual memory places open applications that are not active and portions of active applications on your hard drive and only keeps what is necessary for functionality in real RAM.

Memory Management Unit (MMU) Moves data between physical memory and some slower storage device, usually a disk. It translates the CPU address (logical address) to physical memory address. It moves data from the swap disk to physical memory and from physical memory back to the swap.

How the MMU convert logical address output from the CPU to a physical address CPU MMU Physical Memory Swap Disk Control signal Logical address Physical address

Two primary methods to implement virtual memory Paging Segmentation

Paging and Frames In paging, the entire range of logical addresses is divided into contiguous blocks called pages. Each pages is the same size and each logical address is resides in exactly one page. Physical memory is divided into non- overlapping frames The size of each frame is the same as the size of one page

paging Moves pages from the swap disk to frames of the physical memory so data can be accessed by the processor. Any page can occupy any frame. This leads to several issues must be resolved by a paging system.

Paging issues that are handled by the MMU 1. When should a page be moved into physical memory? 2. How does the CPU find data in physical memory? 3. What happens when all the frames have page and the CPU needs to access data from a page not currently stored in physical memory?

Paging Example: Simple CPU Physical memory space –16K Logical address space –64k Page size –4k 4 frames in physical memory 4k Page F Page 0 Page 1 Page 2 FFFFH F000H 2FFFH 2000H 1FFFH 1000H 0FFFH 0000H Frame 3 Frame 2 Frame 1 Frame 0 3FFFH 3000H 2FFFH 2000H 1FFFH 1000H 0FFFH 0000H Logical memory Address space Physical memory......

Page Table The MMU uses a page table to keep track of which pages are stored in which frames. The MMU uses a page table to calculate the required physical addresses.

Example of Page table and corresponding Physical Memory Frame Valid Count Dirty ABCDEF ABCDEF Page 4 Unused Page 0 Page F 3FFFH 3000H 2FFFH 2000H 1FFFH 1000H 0FFFH 0000H Physical Memory Page Table

Page Fault The page is not located in physical memory. The Memory Management unit would cause the page to be copied from the swap disk to a frame in physical memory.

Demand Paging Memory Management unit would clear a page out of physical memory and move the newly required page into the vacated frame if all frames in physical memory already contained pages.

Begin Process fetched word Compute Physical address X of next Word required Fetch required word From M Is X in M? Is there a free Page frame in M? Select page frame F in M to replace Has F been altered? Transfer page In F to Secondary memory Transfer page containing X Form secondary memory To free page frame in M Update page Address tables Yes No Suspend Normal execution Resume normal execution Yes No Yes No O P E R A T I O N O F A D E M A N D P A G I N G System

Translation Lookaside Buffer (TLB) Because of a time delay associated with reading the frame number from the page table, and the system may read the same value hundreds or thousands of times consecutively as it fetches contiguous instructions, MMU usually contain a TLB.

Conversion of Logical Address to Physical Address Using the TLB Offset Logical address Page Page Frame Valid Offset Frame Physical address: To physical memory

Segmentation Another method of allocating memory that can be used instead of or in conjunction with page. Program is divided into several segments. Segments can vary in size. Segmentation have a segmented MMU.

Segments compared to paging Segments has advantage (internal fragmentation), and disadvantage (external fragmentation)

Internal fragmentation A program of size 4k + 1 would require the MMU to allocate two pages of memory, even though the second page would use one of its 4K locations.

External Fragmentation There are three segments resident in memory and 8K of free space. However, the free spaces is partitioned such that no segment greater than 3K can be loaded into memory with out moving or removing one of the currently loaded segments. Unused Segment 3 Unused Segment 2 Unused Segment 1 16K –1 13K 13K –1 9k 9k –1 6k 6k –1 5k 5k –1 3k 3k –1 0 External fragmentation in physical memory caused by segmentation

Memory Protection Why need Memory Protection? 1. A multitasking operating system may have several different program, or parts of programs, resident in memory simultaneously. 2. These program components may belong to one user or to different users. 3. The operating system may also have components.

Advantages of Virtual Memory You can run more applications at once. You can run larger applications with less real RAM. Applications may launch faster because of File Mapping. You don't have to buy more memory.

Disadvantages of Virtual Memory Applications run slower. It takes more time to switch between applications. Less hard drive space for your use. Reduced system stability.

Thanks The End Do you have any Question ?