Scribe for 7 th April 2014 Page Replacement Algorithms Payal Priyadarshini 11CS30023.

Slides:



Advertisements
Similar presentations
CS Introduction to Operating Systems
Advertisements

9.4 Page Replacement What if there is no free frame?
CS 241 Spring 2007 System Programming 1 Memory Replacement Policies Lecture 32 Klara Nahrstedt.
Page Replacement Algorithms
Page Replacement Algorithms
Virtual Memory (Chapter 4.3)
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.
Chapter 11 – Virtual Memory Management
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
IOS103 OPERATING SYSTEM VIRTUAL MEMORY.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 38 Frame Allocation Read.
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.
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.
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.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
03/29/2004CSCI 315 Operating Systems Design1 Page Replacement Algorithms (Virtual Memory)
CSS430 Virtual Memory Textbook Ch9
Virtual Memory.
Page 19/17/2015 CSE 30341: Operating Systems Principles Optimal Algorithm  Replace page that will not be used for longest period of time  Used for measuring.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
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.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
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.
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.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
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.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Operating Systems Virtual Memory Alok Kumar Jagadev.
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Chapter 9: Virtual-Memory Management
Lecture 39 Syed Mansoor Sarwar
What Happens if There is no Free Frame?
5: Virtual Memory Background Demand Paging
Contents Memory types & memory hierarchy Virtual memory (VM)
Practical Session 8, Memory Management 2
Operating Systems CMPSC 473
Module 9: Virtual Memory
Chapter 9: Virtual Memory CSS503 Systems Programming
Practical Session 9, Memory Management continues
Virtual Memory.
Chapter 8 & 9 Main Memory and Virtual Memory
Module IV Memory Organization.
Presentation transcript:

Scribe for 7 th April 2014 Page Replacement Algorithms Payal Priyadarshini 11CS30023

Page replacement In case of page fault, if all the frames are full then we have to replace/swap out the pages of same process as victim. We should not make pages of another process as victim as it will lead to thrashing. EAT = (1-p) * memory access + p (page fault overhead + swap page out+ swap page in + restart)

Page Replacement

Steps to follow in Page Replacement Choose the victim page from main memory(frame f) of same process. Swap that page out in the swap space. Write back into disk, if the dirty bit is 1. Otherwise dont need to write back. Change the page table entry corresponding to particular page from valid(v) to invalid(i). Swap in the required/demanded page into the main memory. Update the page table entry corresponding to swapped in page to frame f and set valid/invalid bit to v.

Page Replacement

Improving the swap in/out If we have modified that page which we have choose as victim frame. Check dirty bit ( modification leads to 1 ) if it is 1 then, write into the disk otherwise not.

Evaluation : Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string String is just page numbers, not full addresses Repeated access to the same page does not cause a page fault Trace memory references of a process. Sniffer: It will store all the physical addresses generated by CPU. Page Replacement Algorithms How to evaluate Victim page ?

Evaluation (contd) : Reference string of memory accesses : 0100, 0432, 0101, 0612, 0102, 0104, 0101, 0611, 0102 three consecutive access of same page which will lead to only 1 page faults Page size : 100B Reference string 1, 4, 1, 6, 1, 6

Graph of Page Faults Versus The Number of Frames This graph show as we increase the number of frames page fault rate will decrease, which is not always the case with some page replacement algorithms.

First-In-First-Out (FIFO) Algorithm When any frames arrives in the main memory along with that store the corresponding Time- Stamp. Now, select the victim page with the least value of time-stamp. Methods to find out oldest page: - Associates a time with each frame when the page was brought into memory We can maintain a FIFO queue instead of maintaining actual Time-stamp.

FIFO Page Replacement 15 page faults. 3 frames in main memory. How to track ages of pages? Use a FIFO queue to maintain pages in main memory. Replace the page at the head. Inset at tail.

Optimal Page Replacement Replace the pages which we dont require recently. Replace the page that will not be required for longest period of time. 09 page faults. Although we can not predict future, But this algorithm can be the page mark for other algorithm.

Least Recently Used (LRU) Algorithm Use past knowledge rather than future. Past is the proxy for future. Replace the pages that has not been been used in most of the time. Associate time of last use with each page. 12 page faults.

LRU - Implementation Counter implementation CPU maintains a clock Every page entry has a Time of use; every time page is referenced, copy the clock into the time of use When a page needs to be replaced, look at the Time of use to find smallest value Search through table needed

Stack Implementation Stack implementation Keep a stack of page numbers in a double linked list form: Page referenced: move it to the top When page needed to be replaced(victim), remove page from bottom.