Silberschatz, Galvin and Gagne  2002 10.1 Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.

Slides:



Advertisements
Similar presentations
Module 10: Virtual Memory
Advertisements

Chapter 10: Virtual Memory
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Chapter 9: Virtual Memory
Chapter 9 Virtual Memory Bernard Chen 2007 Spring.
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.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 9: Virtual Memory.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory OSC: Chapter 9. Demand Paging Copy-on-Write Page Replacement.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
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.
Gordon College Stephen Brinton
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Virtual Memory.
03/26/2010CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying an earlier.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
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.
Chapter 10: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 10: Virtual Memory.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Revisiting Virtual Memory.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
03/29/2004CSCI 315 Operating Systems Design1 Page Replacement Algorithms (Virtual Memory)
Chapter 9: Virtual Memory. Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Part 8: Virtual Memory. Silberschatz, Galvin and Gagne ©2005 Virtual vs. Physical Address Space Each process has its own virtual address space, which.
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.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Background Virtual memory –
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples Operating.
Operating Systems CMPSC 473 Virtual Memory Management (3) November – Lecture 20 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Outline n Background n Demand.
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.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
10.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 10: Virtual Memory Background Demand Paging Process Creation Page.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
CS307 Operating Systems Virtual Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
Lecture 19 Virtual Memory Demand Paging. Background Virtual memory – separation of user logical memory from physical memory. –Only part of the program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
Virtual Memory The address used by a programmer will be called a virtual address or logical address. An address in main memory is called a physical address.
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 9: Virtual-Memory Management 9.1 Background.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual-Memory Management.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 9: Virtual Memory Background Demand Paging Process.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Virtual Memory CSSE 332 Operating Systems
Chapter 9: Virtual Memory – Part I
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Chapter 9: Virtual-Memory Management
Operating Systems Lecture November 2018.
What Happens if There is no Free Frame?
5: Virtual Memory Background Demand Paging
Chapter 9: Virtual Memory
Chapter 6 Virtual Memory
Operating Systems CMPSC 473
Module 9: Virtual Memory
Virtual Memory.
Presentation transcript:

Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.  Only part of the program needs to be in memory for execution.  Logical address space can therefore be much larger than physical address space.  Allows address spaces to be shared by several processes.  Allows for more efficient process creation. Virtual memory can be implemented via:  Demand paging  Demand segmentation

Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory That is Larger Than Physical Memory

Silberschatz, Galvin and Gagne  Operating System Concepts 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

Silberschatz, Galvin and Gagne  Operating System Concepts Transfer of a Paged Memory to Contiguous Disk Space

Silberschatz, Galvin and Gagne  Operating System Concepts Valid-Invalid Bit With each page table entry a valid–invalid bit is associated (1  in-memory, 0  not-in-memory) Initially valid–invalid but is set to 0 on all entries. Example of a page table snapshot. During address translation, if valid–invalid bit in page table entry is 0  page fault  Frame #valid-invalid bit page table

Silberschatz, Galvin and Gagne  Operating System Concepts Page Table When Some Pages Are Not in Main Memory

Silberschatz, Galvin and Gagne  Operating System Concepts Page Fault If there is ever a reference to a page, first reference will trap to OS  page fault OS looks at another table to decide:  Invalid reference  abort.  Just not in memory. Get empty frame. Swap page into frame. Reset tables, validation bit = 1. Restart instruction:

Silberschatz, Galvin and Gagne  Operating System Concepts Steps in Handling a Page Fault

Silberschatz, Galvin and Gagne  Operating System Concepts What happens if there is no free frame? Page replacement – find some page in memory, but not really in use, swap it out.  algorithm  performance – want an algorithm which will result in minimum number of page faults. Same page may be brought into memory several times.

Silberschatz, Galvin and Gagne  Operating System Concepts Performance of Demand Paging Page Fault Rate 0  p  1.0  if p = 0 no page faults  if p = 1, every reference is a fault Effective Access Time (EAT) EAT = (1 – p) x memory access + p x page fault overhead page fault overhead = swap page out + swap page in + restart overhead

Silberschatz, Galvin and Gagne  Operating System Concepts Demand Paging Example Memory access time = 1 microsecond 50% of the time the page that is being replaced has been modified and therefore needs to be swapped out. page fault overhead Time = 15 msec = 15,000 usec EAT = (1 – p) x 1 + p (15000) P (in msec)

Silberschatz, Galvin and Gagne  Operating System Concepts Page Replacement A algorithm to find victim pages for freeing spaces (swapping out) To minimize unnecessary swap out Prevent over-allocation of memory by modifying page- fault service routine to include page replacement. Use modify (dirty) bit to reduce overhead of page transfers – only modified pages are written to disk.

Silberschatz, Galvin and Gagne  Operating System Concepts Need For Page Replacement

Silberschatz, Galvin and Gagne  Operating System Concepts Page Replacement

Silberschatz, Galvin and Gagne  Operating System Concepts Basic Page Replacement 1. Find the location of the desired page on disk. 2. Find a free frame: - If there is a free frame, use it. - If there is no free frame, use a page replacement algorithm to select a victim frame. 3. Read the desired page into the (newly) free frame. Update the page and frame tables. 4. Restart the process.

Silberschatz, Galvin and Gagne  Operating System Concepts Page Replacement Algorithms Want lowest page-fault rate. Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string.

Silberschatz, Galvin and Gagne  Operating System Concepts Graph of Page Faults Versus The Number of Frames

Silberschatz, Galvin and Gagne  Operating System Concepts FIFO Page Replacement

Silberschatz, Galvin and Gagne  Operating System Concepts Optimal Algorithm Replace page that will not be used for longest period of time. How do you know this? Used for measuring how well your algorithm performs.

Silberschatz, Galvin and Gagne  Operating System Concepts Optimal Page Replacement

Silberschatz, Galvin and Gagne  Operating System Concepts Least Recently Used (LRU) Algorithm Counter implementation  Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter.  When a page needs to be changed, look at the counters to determine which are to change.

Silberschatz, Galvin and Gagne  Operating System Concepts LRU Page Replacement

Silberschatz, Galvin and Gagne  Operating System Concepts Use Of A Stack to Record The Most Recent Page References

Silberschatz, Galvin and Gagne  Operating System Concepts Thrashing If a process does not have “enough” pages, the page- fault rate is very high. This leads to:  low CPU utilization.  operating system thinks that it needs to increase the degree of multiprogramming.  another process added to the system. Thrashing  a process is busy swapping pages in and out.

Silberschatz, Galvin and Gagne  Operating System Concepts Thrashing