Course Title – Computer Architecture And Organization Course Code – CSE 322 Presentation Topic- Virtual Memory Submitted By- 1) Sanjana Moon – ID : 163-15-8443 2) Maisha Mumtaz – ID : 163-15- 8438 3) Iffat Firozy - ID: 163-15-8432 4) Sharmin Akter – ID: 163-15-8436 5) Umme Fatema Tuj – ID: 163-15-8395 Submitted To – Mr. Gazi Zhirul Islam (Assistant Professor) Dept of CSE
Khandakar Sanjana Akter ID : 163-15-8443
What is Virtual Memory ? Virtual Memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory . The purpose of virtual memory is to enlarge the ”Address Space” With virtual memory – A system can load larger programs or multiple programs running at the same time, allowing each one to operate as if it has infinite memory and without having to purchase more RAM. Virtual Memory can be implemented via- Demand Paging Demand segmentation
Virtual Memory Diagram Secondary Memory
How Does it Works?
Why we use it? Multitasking When a computer user opens multiple programs at once, the data for these programs must be stored in memory for quick access. The more programs are open, the more memory is needed. When the computer's physical memory is full, the excess data is stored in virtual memory . Large Programs virtual memory allows programmers to create larger and more complex applications. When these programs are running, they occupy physical memory as well as virtual memory.
Maisha Mumtaz Monsur ID:163-15-8438
What is mapping process? The transformation of data from main memory to cache memory is called mapping .
Usually every process has its own mapping table .
There are three different types of mapping used for the purpose of cache memory are as follow: 1. Direct mapping, 2. Associative mapping, 3.and Set-Associative mapping.
Demand Paging * Bring a page into memory only when it is needed .Less I/O needed .Less memory needed .Faster response .More users * Page is needed ⇒ reference to it .invalid reference ⇒ abort .not-in-memory ⇒ bring to memory
Transfer of a Paged Memory to Contiguous Disk Space
Iffat Firozy ID- 163-15-8432
Process A process is an instance of a program running in a computer. It is close in meaning to task , a term used in some operating systems. In other words, process is the state of a running program.
Address Translation
Example
Sharmin Akter ID: 163-15-8436
Paging Paging is a method of writing data and reading it from, secondary storage for use in primary storage, also known as main memory. Paging plays a role in memory management for a computer's OS (operating system).
Page Tables 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. The entire page table may take up too much main memory. Page tables are also stored in virtual memory. When a process is running, part of its page table is in main memory.
Page Size Smaller page size, less amount of internal fragmentation. Smaller page size, more pages required per process. More pages per process means larger page tables. Larger page tables means large portion of page tables in virtual memory.
Page Faults A page fault is a type of exception raised by computer hardware when a running program accesses a memory page that is not currently mapped by memory management unit (MMU) into the virtual address space of a process or we can say, A miss in the page table is called a page fault. When the “valid” bit is not set to 1, then the page must be brought in from disk, possibly replacing another page in memory.
Umme Fatema Tuj Asha ID : 163-15-8395
Virtual Memory Sharing Virtual memory makes it easy for processes to share memory as all memory accesses are decoded using page tables. For processes to share the same virtual memory , the same physical pages are referenced by many processes. The page tables for each process contain the Page Table Entries that have the same physical PFN.
Figure : Sharing Physical Memory Between Processes. Figure shows two processes that each have physical piece2 in their virtual memory map.
Advantages and Disadvantages of Virtual Memory Advantages Protection Sharing VM supports Swapping Disadvantages Memory requirements (mapping tables) Longer memory access times ( mapping table lookup)