Virtual Memory Virtual memory is a technique which gives an application program the impression that it has contiguous working memory, while in fact it.

Slides:



Advertisements
Similar presentations
Logical Operations on Images Boolean logic is a system of logical operations defined by George Boole in the mid 19th century to apply algebraic operations.
Advertisements

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. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Multiprocessing Memory Management
Memory Management 2010.
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.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
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.
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.
Syndrome Decoding of Linear Block Code
Review of Memory Management, Virtual Memory CS448.
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
IT253: Computer Organization
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
Computer Studies (AL) Memory Management Virtual Memory I.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Line Coding Schemes ‏Line coding is the process of converting binary data, a sequence of bits to a digital signal. Authors Phani Swathi Chitta Mentor Prof.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Edge Detection using Laplacian of Gaussian Edge detection is a fundamental tool in image processing and computer vision. It identifies points in a digital.
Gaussian Smoothing Gaussian Smoothing is the result of blurring an image by a Gaussian function. It is also known as Gaussian blur.  Course Name: Digital.
CSMA/CD Simulation Carrier Sense Multiple Access (CSMA), although more efficient than ALOHA or slotted ALOHA, still has one glaring inefficiency: When.
Linear Search Linear Search is a fundamental search algorithm. Linear search, also known as sequential search, is a process that checks every element in.
Median Filtering In signal processing, it is often desirable to be able to perform some kind of noise reduction on an image or signal. The median filter.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Virtual Memory.
Lecture 11 Virtual Memory
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Virtual Memory CSSE 332 Operating Systems
Chapter 2 Memory and process management
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Virtual Memory User memory model so far:
Virtual Memory Chapter 8.
Main Memory Management
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.
Prof. Saravanan Vijayakumaran
Chapter 8: Memory management
Chapter 9: Virtual Memory
Dilation The basic morphological operations applied to either grayscale or binary images are Erosion and Dilation. Erosion shrinks image objects while.
Closing One of the important morphological operations applied to either grayscale or binary images is Closing. It is derived from the fundamental operations.
Erosion The basic morphological operations applied to either grayscale or binary images are Erosion and Dilation. Erosion shrinks image objects while.
CSE 451: Operating Systems Autumn 2005 Memory Management
Binary Search A binary search algorithm finds the position of a specified value within a sorted array. Binary search is a technique for searching an ordered.
Sorted Linked List A linked list is a data structure that consists of a sequence of data records such that in each record there is a field that contains.
Contents Memory types & memory hierarchy Virtual memory (VM)
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CSC3050 – Computer Architecture
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Operating Systems: Internals and Design Principles, 6/E
CSE 542: Operating Systems
Party Problem The simplest example of Ramsey theory. It is also known as the ‘Maximum Clique Problem’. A clique of a graph is a complete sub graph of the.
Virtual Memory 1 1.
Opening One of the important morphological operations applied to either grayscale or binary images is Opening. It is derived from the fundamental operations.
Image Sharpening using Laplacian
Presentation transcript:

Virtual Memory Virtual memory is a technique which gives an application program the impression that it has contiguous working memory, while in fact it may be physically fragmented and may overflow on to disk storage. Course Name: Operating Systems Level(UG/PG): UG Author(s) : Phani Swathi Chitta Mentor: Aruna Adil *The contents in this ppt are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 2.5 India license

Learning Objectives After interacting with this Learning Object, the learner will be able to: Explain the concept of virtual memory

1 2 3 4 5 Definitions of the components/Keywords: Glossary: Virtual Memory: It is a technique which gives an application program the impression that it has contiguous address space but physically it is fragmented in the main memory and secondary storage devices. Physical Memory: It refers to the real storage and describes the total amount of memory installed in the computer. Usually consists of Random Access Memory (RAM) and hard drives. Page Table: A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses and physical addresses. It has the ability to mark an entry invalid through valid-invalid bit. TLB: TLB [Translation Lookaside Buffer] is a table in the processor’s memory that contains information about the pages in memory the processor has accessed recently. The table cross-references a program’s virtual addresses with the corresponding absolute addresses in physical memory that the program has most recently used. 2 3 4 5

1 2 3 4 5 Definitions of the components/Keywords: Glossary: Paging: In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called pages. Memory Management Unit: A memory management unit (MMU), sometimes called paged memory management unit (PMMU), is a computer hardware component responsible for handling accesses to memory requested by the CPU. Its functions include translation of virtual addresses to physical addresses (i.e., virtual memory management), memory protection, cache control, bus arbitration and in simpler computer architectures (especially 8-bit systems), bank switching. Demand Paging: A refinement of paging in which it is not necessary to load in the entire contents of the text and data segments of a program from disk when the process is started. Instead, pages are brought into memory as they are accessed. Lazy Swapper: A lazy swapper never swaps a page into memory unless that page will be needed. 2 3 4 5

1 2 3 4 5 Definitions of the components/Keywords: Glossary: Virtual Address Space: The virtual address space of a process refers to the logical view of how a process is stored in memory. Thrashing: It is a degenerate situation where large amounts of computer resources are used to do a minimal amount of work. Segmentation: Segmentation is a memory management technique in which memory is divided into variable sized chunks which can be allocated to processes. Each chunk is called a segment. 2 3 4 5

1 2 3 4 5 Definitions of the components/Keywords: Virtual Memory is a technique which gives an application program the impression that it has contiguous working memory, while in fact it may be physically fragmented and may overflow on to disk storage. Programs use virtual addresses than real addresses to atore data. When the program is actually executed, the virtual addresses are converted into real memory addresses. When a process requests access to its memory, it is the responsibility of the operating system to map the virtual address to the physical address. A page table is used to store mapping between virtual addresses and physical addresses. 2 3 4 5

1 2 3 4 5 Analogy Person Looks for money House Got enough money? No Yes 3 Goes to the Bank Need Fulfilled Bank 4 Here HOUSE acts as the physical memory and BANK acts as the backing store 5

Analogy 1 If a person needs money, first he will check in his house. If he cannot find out enough money there then he will go to the bank and withdraw the money that he needs. Here bank is analogous to virtual storage space and house or wallet is analogous to the physical space. 2 3 4 5

1 Master Layout 1 2 3 4 5 Give a PLAY button Give PAUSE and RESTART/CLEAR buttons Give two radio buttons FAST and SLOW 5

3 Step 1: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) When the user clicks PLAY, show fig in the master layout The text in DT should appear in parallel to the figure The process of finding the page is shown in the next slides Follow the figures and the flow of finding the page should be accordingly Programs use virtual address to store data When a program is executed, virtual address is converted to real logical address A page table is used to store mapping between virtual address and logical address 5

3 Step 2: 1 2 4 5 Page 0 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 0 Here Application program tries to access page 0 So first the TLB is checked for the virtual address 000v 5

3 Step 3: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure It exists in TLB and it means a TLB Hit which says page 0 exists in physical memory itself SO Page 0 can be accessed directly from physical memory 5

3 Step 4: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 0 can be accessed directly from physical memory since it is found in physical memory 5

3 Step 5: 1 2 4 5 Page 1 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 1 Here Application program tries to access page 1 So first the TLB is checked for the virtual address 111v 5

3 Step 6: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 1 does not exist in TLB and it means a TLB miss Now page table is to be checked 5

3 Step 7: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page table is checked for 111v and is not present which results in a page fault Now secondary memory is to checked for 111v 5

3 Step 8: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Now secondary memory is checked for 111v It exists there Now page 1 will be shifted from secondary memory to physical memory Appropriate updating is done in TLB and page table 5

3 Step 9: 1 2 4 5 Page 2 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 2 Here Application program tries to access page 2 So first the TLB is checked for the virtual address 222v 5

3 Step 10: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure It exists in TLB and it means a TLB Hit which says page 2 exists in physical memory itself SO Page 2 can be accessed directly from physical memory 5

3 Step 11: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 2 can be accessed directly from physical memory since it is found in physical memory 5

3 Step 12: 1 2 4 5 Page 3 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 3 Here Application program tries to access page 3 So first the TLB is checked for the virtual address 333v 5

3 Step 13: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 3 does not exist in TLB and it means a TLB miss Now page table is to be checked 5

3 Step 14: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page table is checked for 333v and is not present which results in a page fault Now secondary memory is to checked for 333v 5

3 Step 15: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Now secondary memory is checked for 333v It exists there Now page 3 will be shifted from secondary memory to physical memory Appropriate updating is done in TLB and page table 5

3 Step 16: 1 2 4 5 Page 4 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 4 Here Application program tries to access page 4 So first the TLB is checked for the virtual address 444v 5

3 Step 17: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure It exists in TLB and it means a TLB Hit which says page 4 exists in physical memory itself SO Page 4 can be accessed directly from physical memory 5

3 Step 18: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 4 can be accessed directly from physical memory since it is found in physical memory 5

3 Step 19: 1 2 4 5 Page 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 5 Here Application program tries to access page 5 So first the TLB is checked for the virtual address 555v 5

3 Step 20: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 5 does not exist in TLB and it means a TLB miss Now page table is to be checked 5

3 Step 21: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 5 is found in page table 5

3 Step 22: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Now page 5 is present in page table but not in TLB So an entry should be done in TLB Now TLB is updated 5

3 Step 23: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Now page 5 exists in both TLB and page table The logical address will be got from TLB and can access page 5 from physical memory 5

3 Step 24: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 5 is found in physical memory 5

3 Step 25: 1 2 4 5 Page 6 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 6 Here Application program tries to access page 6 So first the TLB is checked for the virtual address 666v 5

3 Step 26: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 6 does not exist in TLB and it means a TLB miss Now page table is to be checked 5

3 Step 27: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 6 is not present in page table which results in a page fault. Now secondary memory is to be checked for 666v 5

3 Step 28: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure 666v is present in secondary memory. Now it has to be moved to physical memory But physical memory is full. So we have to make use of some replacement algorithm to make room available for page 6 5

3 Step 29: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Here LRU [Least Recently Used] algorithm is used Then page 0 which is least recently used, is moved to secondary memory and page 6 is now present in physical memory Appropriate updates are done in TLB, page table and secondary memory 5

3 Step 30: 1 2 4 5 Page 7 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Memory Access of Page 7 Here Application program tries to access page 7 So first the TLB is checked for the virtual address 777v 5

3 Step 31: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 7 does not exist there and it means a TLB miss So page table is to be checked 5

3 Step 32: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 7 is not present in page table also and which results in a page fault Now secondary memory is to be checked for 777v 5

3 Step 33: 1 2 4 5 Instruction for the animator Text to be displayed in the working area (DT) The action showed in the figure must be performed The text in DT should appear in parallel to the figure Page 7 is not present in secondary memory too. Now 777v exists in neither page table nor in secondary memory It means no translation is available for 777v – that is page 7 is not present anywhere It may be due to some program error. So either system will provide some error message or OS will use some techniques to handle the ________ 5

Test your understanding Electrical Engineering Slide 1 Slide 3 Slide 44-46 Slide 47 Introduction Definitions Analogy Test your understanding (questionnaire)‏ Lets Sum up (summary)‏ Want to know more… (Further Reading)‏ Interactivity: Try it yourself The same algorithm as in demo is followed When a page is selected, show the process how the page is found The layout must be the same as in slide 10 Give page numbers in the application program as radio buttons Give two radio buttons as FAST and SLOW 43 Credits

Questionnaire 1 1. Which is bigger, virtual memory or physical memory? Answers: a) Virtual Memory b) Physical Memory c) Any of them 2 3 4 5

Questionnaire 1 2. How are the pages actually kept in the physical memory which are referenced in the virtual memory? Answers: a) Contiguously Pages are kept non-contiguously in physical memory b) Non-contiguously c) Can’t say 2 3 4 5

4 Questionnaire 1 2 3 5 3. The advantages of virtual memory are: i) Programmer don’t need to bother about the size of the program ii) Number of processes that can reside in main memory is less iii) Less I/O would be needed to load or swap a program Answers: i & ii comment - Number of processes that can reside in main memory is more b) i & iii c) ii & iii d) None 2 3 4 5

Links for further reading Reference websites: http://en.wikipedia.org/wiki/Virtual_memory http://en.wikipedia.org/wiki/Page_table Books: