Lecture 39 Syed Mansoor Sarwar

Slides:



Advertisements
Similar presentations
9.4 Page Replacement What if there is no free frame?
Advertisements

Page Replacement Algorithms
Chapter 101 The LRU Policy Replaces the page that has not been referenced for the longest time in the past By the principle of locality, this would be.
Module 10: Virtual Memory
Chapter 10: Virtual Memory
Page Replacement Algorithms (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
Scribe for 7 th April 2014 Page Replacement Algorithms Payal Priyadarshini 11CS30023.
Virtual Memory Management G. Anuradha Ref:- Galvin.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
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 ©2009 Operating System Concepts – 8 th Edition, Lecture 15: Background Information for the VMWare ESX Memory Management.
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.
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.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
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.
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.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
CSC 360, Instructor: Kui Wu Memory Management II: Virtual Memory.
CS307 Operating Systems Virtual Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical 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 ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Chapter 9: Virtual Memory
Topic 8 (Textbook - Chapter 9) Virtual Memory
Logistics Homework 5 will be out this evening, due 3:09pm 4/14
OPERATING SYSTEM CONCEPTS AND PRACTISE
Chapter 9: Virtual Memory – Part I
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Review.
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?
Lecture 40 Syed Mansoor Sarwar
5: Virtual Memory Background Demand Paging
Lecture 32 Syed Mansoor Sarwar
Lecture 38 Syed Mansoor Sarwar
Chapter 6 Virtual Memory
Lecture 37 Syed Mansoor Sarwar
Operating Systems CMPSC 473
Module 9: Virtual Memory
Chapter 9: Virtual Memory CSS503 Systems Programming
Virtual Memory.
Presentation transcript:

Lecture 39 Syed Mansoor Sarwar Operating Systems Lecture 39 Syed Mansoor Sarwar

© Copyright Virtual University of Pakistan Agenda for Today Review of the previous lecture Page Replacement Page Replacement Algorithms First-In-First-Out (FIFO) Optimal Replacement Least Recently Used (LRU) Belady’s Anomaly Stack Replacement Algorithms 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Review of Lecture 38 Performance of Demand Paging Process Creation Memory Mapped Files 30 November 2018 © Copyright Virtual University of Pakistan

Performance of Demand Paging Effective Access Time (EAT) EAT = (1 – p) x memory access time + p (page fault service time) 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example Memory access time = 100 nanosec Page fault service time = 25 millisec Teffective = (1 - p) x 100 + p (25 milli) = (1 - p) x 100 + p (25000000) = 100 + 24999900 x p If one access out of 1000 causes a page fault, effective access time is 25 microseconds, a slowdown by a factor of 250. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example If we want less than 10 percentage degradation in effective memory access time then we have the following inequality 110 > 100 + 25000000 x p 10 > 25000000 x p p < 0.0000004 This means we can allow only one page fault every 2,500,000. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Process Creation “Copy-on-write”—child shares parent’s address space and is given its own copy of “copy-on-write” pages when it tries to modify them vfork()—child shares parent’s address space; useful when child invokes exec() immediately after its creation 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Memory-Mapped Files Memory-mapped file I/O allows file I/O to be treated as routine memory access by mapping a disk block to a page in memory. Automatically or by using the mmap() system call on Solaris 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Memory-Mapped Files 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Page Replacement If no free frame is available on a page fault, replace a page in memory to load the desired page Page-fault service routine is modified to include page replacement. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Page Replacement Use modify (dirty) bit to reduce overhead of page transfers – only modified pages are written to disk. Set by hardware when data is written to a page Checked by OS at page replacements 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Page Replacement 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Page Replacement M 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Page Replacement 30 November 2018 © Copyright Virtual University of Pakistan

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. 30 November 2018 © Copyright Virtual University of Pakistan

Page Faults vs. Number of Frames 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan FIFO Algorithm Number of frame allocated = 4 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Optimal Algorithm Replace the page that will not be used for the longest period of time. 30 November 2018 © Copyright Virtual University of Pakistan

Least Recently Used (LRU) Algorithm Replace the page that hasn’t been used for the longest period of time. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan LRU Example 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan LRU Implementation Counter-Based 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 replaced, choose the one with minimum counter value. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan LRU Implementation Stack-based Implementation Keep a stack of page numbers. Whenever a page is referenced, remove it from its current location and push it onto the stack. The LRU page is at the bottom of the stack. Doubly-linked list implementation of stack requires 6 pointer changes. 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan LRU Implementation 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Recap of Lecture Page Replacement Page Replacement Algorithms First-In-First-Out (FIFO) Optimal Replacement Least Recently Used (LRU) 30 November 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Operating Systems Lecture 39 Syed Mansoor Sarwar 30 November 2018 © Copyright Virtual University of Pakistan