Virtual Memory Deung young, Moon ELEC 5200/6200 Computer Architecture and Design Lectured by Dr. V. Agrawal Lectured by Dr. V.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Chapter 3 Memory Management: Virtual Memory
Multiprocessing Memory Management
CS 104 Introduction to Computer Science and Graphics Problems
Memory Management 2010.
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.
Memory Management Chapter 5.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
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.
CSCI2413 Lecture 6 Operating Systems Memory Management 2 phones off (please)
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Chapter 3 Memory Management: Virtual Memory
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of.
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.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Chapter 4 Memory Management Virtual Memory.
Virtual Memory By Steven LaBarbera. What I plan to cover  The history of virtual memory  How virtual memory has evolved  How virtual memory is used.
Memory Management COSC 513 Presentation Jun Tian 08/17/2000.
Fundamentals of Programming Languages-II Subject Code: Teaching SchemeExamination Scheme Theory: 1 Hr./WeekOnline Examination: 50 Marks Practical:
Virtual Memory Virtual Memory is created to solve difficult memory management problems Data fragmentation in physical memory: Reuses blocks of memory.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
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.
Computer Systems Week 14: Memory Management Amanda Oddie.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
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.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Virtual Memory From course notes University of Waikato. Some material by Tony McGregor Other material from: The Architecture.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main 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.
Computer Organization
Memory Management.
Chapter 2 Memory and process management
Understanding Operating Systems Seventh Edition
Chapter 9 – Real Memory Organization and Management
CSI 400/500 Operating Systems Spring 2009
Virtual Memory Chapter 8.
Operating System Concepts
O.S Lecture 13 Virtual Memory.
Chapter 9: Virtual-Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Computer Architecture
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 3: Main Memory.
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CSC3050 – Computer Architecture
Computer Architecture and Organization (CS-507)
COMP755 Advanced Operating Systems
Page Main Memory.
Presentation transcript:

Virtual Memory Deung young, Moon ELEC 5200/6200 Computer Architecture and Design Lectured by Dr. V. Agrawal Lectured by Dr. V.

Memory register CPU cache Main Memory Secondary Storage Server (or INTERNET) larger capacity lower speed lower cost

What is… Virtual memory as an alternate set of memory addresses. Virtual memory as an alternate set of memory addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. Programs use these virtual addresses rather than real addresses to store instructions and data. When the program is actually executed, the virtual addresses are converted into real memory addresses. When the program is actually executed, the virtual addresses are converted into real memory addresses.

History virtual memory was developed in approximately 1959 – 1962, at the University of Manchester for the Atlas Computer, completed in virtual memory was developed in approximately 1959 – 1962, at the University of Manchester for the Atlas Computer, completed in In 1961, Burroughs released the B5000, the first commercial computer with virtual memory. In 1961, Burroughs released the B5000, the first commercial computer with virtual memory.

Why is it needed…. Before the development of the virtual memory technique, programmers in the 1940s and 1950s had to manage directly two-level storage such as main memory or ram and secondary memory in the form of hard disks or earlier, magnetic drums. Before the development of the virtual memory technique, programmers in the 1940s and 1950s had to manage directly two-level storage such as main memory or ram and secondary memory in the form of hard disks or earlier, magnetic drums. Enlarge the address space, the set of addresses a program can utilize. Enlarge the address space, the set of addresses a program can utilize. Virtual memory might contain twice as many addresses as main memory. Virtual memory might contain twice as many addresses as main memory.

Object… When a computer is executing many programs at the same time, Virtual memory make the computer to share memory efficiently. When a computer is executing many programs at the same time, Virtual memory make the computer to share memory efficiently. Eliminate a restriction that a computer works in memory which is small and be limited. Eliminate a restriction that a computer works in memory which is small and be limited. When many programs is running at the same time, by distributing each suitable memory area to each program, VM protect programs to interfere each other in each memory area. When many programs is running at the same time, by distributing each suitable memory area to each program, VM protect programs to interfere each other in each memory area.

How does it work… To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. Each page is stored on a disk until it is needed. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real addresses. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real addresses.

MMU (Memory Management Unit) The hardware base that makes a virtual memory system possible. The hardware base that makes a virtual memory system possible. Allows software to reference physical memory by virtual addresses, quite often more than one. Allows software to reference physical memory by virtual addresses, quite often more than one. It accomplishes this through the use of page and page tables. It accomplishes this through the use of page and page tables. Use a section of memory to translate virtual addresses into physical addresses via a series of table lookups. Use a section of memory to translate virtual addresses into physical addresses via a series of table lookups. The software that handles the page fault is generally part of an operating system and the hardware that detects this situation. The software that handles the page fault is generally part of an operating system and the hardware that detects this situation.

Segmentation…… Segmentation involves the relocation of variable sized segments into the physical address space. Segmentation involves the relocation of variable sized segments into the physical address space. Generally these segments are contiguous units, and are referred to in programs by their segment number and an offset to the requested data. Generally these segments are contiguous units, and are referred to in programs by their segment number and an offset to the requested data. Efficient segmentation relies on programs that are very thoughtfully written for their target system. Efficient segmentation relies on programs that are very thoughtfully written for their target system. Since segmentation relies on memory that is located in single large blocks, it is very possible that enough free space is available to load a new module, but can not be utilized. Since segmentation relies on memory that is located in single large blocks, it is very possible that enough free space is available to load a new module, but can not be utilized. Segmentation may also suffer from internal fragmentation if segments are not variable-sized, where memory above the segment is not used by the program but is still “reserved” for it. Segmentation may also suffer from internal fragmentation if segments are not variable-sized, where memory above the segment is not used by the program but is still “reserved” for it.

Paging…… Paging provides a somewhat easier interface for programs, in that its operation tends to be more automatic and thus transparent. Paging provides a somewhat easier interface for programs, in that its operation tends to be more automatic and thus transparent. Each unit of transfer, referred to as a page, is of a fixed size and swapped by the virtual memory manager outside of the program’s control. Each unit of transfer, referred to as a page, is of a fixed size and swapped by the virtual memory manager outside of the program’s control. Instead of utilizing a segment/offset addressing approach, as seen in segmentation, paging uses a linear sequence of virtual addresses which are mapped to physical memory as necessary. Instead of utilizing a segment/offset addressing approach, as seen in segmentation, paging uses a linear sequence of virtual addresses which are mapped to physical memory as necessary. Due to this addressing approach, a single program may refer to series of many non-contiguous segments. Due to this addressing approach, a single program may refer to series of many non-contiguous segments. Although some internal fragmentation may still exist due to the fixed size of the pages, the approach virtually eliminates external fragmentation. Although some internal fragmentation may still exist due to the fixed size of the pages, the approach virtually eliminates external fragmentation.

Paging……(cont’d) A technique used by virtual memory operating systems to help ensure that the data you need is available as quickly as possible. A technique used by virtual memory operating systems to help ensure that the data you need is available as quickly as possible. The operating system copies a certain number of pages from your storage device to main memory. The operating system copies a certain number of pages from your storage device to main memory. When a program needs a page that is not in maim memory, the operating system copies the required page into memory and copies another page back to the disk. When a program needs a page that is not in maim memory, the operating system copies the required page into memory and copies another page back to the disk.

Virtual Memory (Paging) Page table Address Space Page table Address Space Physical Memory

Page fault An interrupt to the software raised by the hardware when a program accesses a page that is not mapped in physical memory. An interrupt to the software raised by the hardware when a program accesses a page that is not mapped in physical memory. when a program accesses a memory location in its memory and the page corresponding to that memory is not loaded when a program accesses a memory location in its memory and the page corresponding to that memory is not loaded when a program accesses a memory location in its memory and the program does not have privileges to access the page corresponding to that memory. when a program accesses a memory location in its memory and the program does not have privileges to access the page corresponding to that memory.

Paging replacement algorithms OPT(MIN) : eliminate the page that be not expected to be used. OPT(MIN) : eliminate the page that be not expected to be used. FIFO(first input/first output) : rather than choosing the victim page at random, the oldest page is the first to be removed. FIFO(first input/first output) : rather than choosing the victim page at random, the oldest page is the first to be removed. LRU(Least Recently used) : move out the page that is the least rarely used. LRU(Least Recently used) : move out the page that is the least rarely used. LFU(Least Frequently used) : move out the page that is not used often in the past. LFU(Least Frequently used) : move out the page that is not used often in the past.

Summary… Virtual memory is a common part of most operating systems on computers. Virtual memory is a common part of most operating systems on computers. It has become so common because it provides a big benefit for users at a very low cost. It has become so common because it provides a big benefit for users at a very low cost. benefits of executing a program that is only partially in memory. benefits of executing a program that is only partially in memory. program is no longer constrained by the amount of physical memory. program is no longer constrained by the amount of physical memory. ⇒ user would be able to write programs for an extremely large virtual address space. ⇒ user would be able to write programs for an extremely large virtual address space. more programs could be run at the same time more programs could be run at the same time ⇒ increase CPU utilization and throughput. less I/O would be needed to load or swap each user program less I/O would be needed to load or swap each user program ⇒ run faster