SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally VIRTUALMEMORY.

Slides:



Advertisements
Similar presentations
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Advertisements

Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 36 Virtual Memory Read.
Virtual Memory Management G. Anuradha Ref:- Galvin.
Virtual Memory Operating System Concepts chapter 9 CS 355
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 9: Virtual Memory Background Demand Paging.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Virtual-Memory Management
CS 153 Design of Operating Systems Spring 2015
Memory Management Design & Implementation Segmentation Chapter 4.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 9: Virtual Memory Background.
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 and Architecture
Virtual Memory I Chapter 8.
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Dr Damitha Karunaratna University of Colombo school of computing
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.
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.
CS212: OPERATING SYSTEM Lecture 6: Virtual-Memory Management 1 Computer Science Department.
Computer Studies (AL) Memory Management Virtual Memory I.
Silberschatz, Galvin and Gagne Operating System Concepts Chapter 9: Virtual Memory.
Chapter 4 Memory Management Virtual Memory.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
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.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
CS307 Operating Systems Virtual Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
Virtual Memory Various memory management techniques have been discussed. All these strategies have the same goal: to keep many processes in memory simultaneously.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
1 Virtual Memory. Cache memory: provides illusion of very high speed Virtual memory: provides illusion of very large size Main memory: reasonable cost,
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 Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual-Memory Management.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Virtual Memory.
Virtual Memory CSSE 332 Operating Systems
Chapter 9: Virtual Memory – Part I
Paging COMP 755.
ITEC 202 Operating Systems
Chapter 9: Virtual Memory
Operating Systems Virtual Memory Alok Kumar Jagadev.
Virtual Memory Chapter 8.
Chapter 9: Virtual Memory
O.S Lecture 13 Virtual Memory.
Chapter 9: Virtual-Memory Management
Operating Systems Lecture November 2018.
Computer Architecture
Module IV Memory Organization.
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Operating Systems: Internals and Design Principles, 6/E
Virtual Memory.
Chapter 8 & 9 Main Memory and Virtual Memory
Module IV Memory Organization.
Presentation transcript:

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally VIRTUALMEMORY

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally To execute a program, the entire process should be loaded into the main memory. Thus the size of the process is limited to the size of the physical memory. A memory management scheme called “Overlaying” can be used to overcome this situation. Introduction

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally The programmer splits a program into smaller parts called overlays in such a way that no two overlays are required to be in main memory at the same time. An overlay is loaded into memory only when it is needed. One major disadvantage of this technique is that it requires major involvement of the programmer and time consuming. Overlaying

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Virtual memory is a technique that allows execution of a program that is bigger than the physical memory of the computer system. In this technique, the operating system loads only those parts of program in memory that are currently needed for the execution of the process. The rest part is kept in the disk and is loaded into memory only when needed. Virtual Memory – overview

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Virtual Memory – overview

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Virtual memory gives the illusion that the system has a much larger memory than is actually available. Virtual memory frees programs from the constraints of physical memory limitation. The virtual memory can be implemented by: Demand Paging. Demand Segmentation. Virtual Memory – overview

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Demand paging is a system which a page is loaded into the memory only when it is needed during program execution. Pages that are never accessed are never loaded into the memory. A demand paging system combines the features of paging with swapping. To facilitates swapping, the entire virtual address space is stored contiguously on the disk. Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Whenever a process is to be executed, an area on the disk is allocated to it on which pages are copied, called swap space of the process. During the execution of a process, whenever a page is required, it is loaded into the main memory from the swap space. Similarly, when a process is to be removed from main memory, it is written back into the swap space if it has been modified. Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Other than swap space, some form of hardware support is also needed to differentiate the pages that are in memory from the ones on disk. For this, only an additional bit valid is maintained in each page table entry to indicate whether the page is in memory. If a page is valid, that is it exists in the virtual address space of the process, the associated valid bit is set to 1, otherwise it is set to 0. Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Whenever a process request for a page, the virtual address is sent to MMU. The MMU checks the valid bit in the page table entry of that page. If the valid bit is 1, it is access as in paging. Otherwise, the MMU raises an interrupt called page fault or a missing page interrupt and the control is passed to the page fault routine in the operating system. Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally Demand Paging

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally To handle the page fault, the page fault routine first of all checks whether the virtual address for the desired page is valid from its PCB stored in the process table. If it is invalid, it terminates the process giving error. Otherwise, it takes the following steps: Demand Paging - Handing Page Fault

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally 1.Location for a free page frame in memory and allocation it to the process. 2.Swaps the desired page into this allocated page frame. 3.Update the process table and page table to indicate that the page is in memory. After performing these steps, the CPU restarts from the instruction that it left off due to the page fault. Demand Paging - Handing Page Fault

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally In demand paging, the process of loading a page in memory is known as page-in operation instead of swap-in. It is because the whole process is not loaded; only some pages are loaded into the memory. Demand Paging – page-in

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally It reduces the swap time since only the required pages are swapped in instead of the whole process. It increases the degree of multiprogramming by reducing the amount of physical memory required for a process. It minimizes the initial disk overhead as not all pages are to be read initially. It does not need extra hardware support. Demand Paging - Advantages

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally A process may need to create several processes during its execution and the parent and child processes have their own distinct address spaces. If the newly created process is the duplicate of the parent process, it will contain the same pages in its address space as that of parent. In this case, copying the parent’s address space may be unnecessary. To avoid copying, copy-on-write – a virtual memory technique can be employed. COPY-ON-WRITE

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally In this technique, initially, parent and child processes are allowed to share the same pages and these shared pages are marked as copy-on-write pages. Now, if either process attempts to write on a shared page, a copy of that page is created for that process. Only the pages that can be modified (containing data) are marked as copy- on-write pages while the pages that cannot be modified (containing executable code) are shared between parent and child processes. COPY-ON-WRITE

SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally To implement this, a bit is associated in page table entry of each shared page to indicate that it is a copy-on-write page. Whenever either process say, child process tries to modify a page, the operating system creates a copy of that page, maps it to the address space of the child process and turns off the copy-on-write bit. Now the child process can modify the copied page without affecting the page of the parent process. Thus, it saves memory. COPY-ON-WRITE