Second-Chance Algorithm Basically, it’s a FIFO algorithm When a page has been selected, we inspect its reference bit. If the value is 0, we proceed to.

Slides:



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

Page Replacement Algorithms
Virtual Memory (Chapter 4.3)
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
Virtual Memory Operating System Concepts chapter 9 CS 355
Allocation of Frames Each process needs minimum number of pages
Operating Systems Prof. Navneet Goyal Department of Computer Science & Information Systems BITS, Pilani.
Page 15/4/2015 CSE 30341: Operating Systems Principles Allocation of Frames  How should the OS distribute the frames among the various processes?  Each.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 38 Frame Allocation Read.
03/31/2004CSCI 315 Operating Systems Design1 Allocation of Frames & Thrashing (Virtual Memory)
Chapter 101 Cleaning Policy When should a modified page be written out to disk?  Demand cleaning write page out only when its frame has been selected.
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.
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
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
Memory Management Design & Implementation Segmentation Chapter 4.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Virtual Memory.
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.
Chapter 10 Virtual Memory
Virtual Memory Basic Concepts Demand Paging
Memory Management 2 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
03/29/2004CSCI 315 Operating Systems Design1 Page Replacement Algorithms (Virtual Memory)
CSS430 Virtual Memory Textbook Ch9
Virtual Memory.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
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.
Part 8: Virtual Memory. Silberschatz, Galvin and Gagne ©2005 Virtual vs. Physical Address Space Each process has its own virtual address space, which.
CS212: OPERATING SYSTEM Lecture 6: Virtual-Memory Management 1 Computer Science Department.
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.
9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
CSC 360, Instructor: Kui Wu Memory Management II: Virtual Memory.
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.
Page Buffering, I. Pages to be replaced are kept in main memory for a while to guard against poorly performing replacement algorithms such as FIFO Two.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual-Memory Management.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Virtual Memory. 2 Last Week Memory Management Increase degree of multiprogramming –Entire process needs to fit into memory Dynamic Linking and Loading.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Virtual Memory.
SLC/VER1.0/OS CONCEPTS/OCT'99
OPERATING SYSTEM CONCEPTS AND PRACTISE
Chapter 9: Virtual Memory
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Chapter 9: Virtual-Memory Management
Lecture 40 Syed Mansoor Sarwar
5: Virtual Memory Background Demand Paging
Chapter 9: Virtual Memory
Operating Systems CMPSC 473
Lecture 41 Syed Mansoor Sarwar
Module 9: Virtual Memory
Chapter 9: Virtual Memory CSS503 Systems Programming
Virtual Memory.
Presentation transcript:

Second-Chance Algorithm Basically, it’s a FIFO algorithm When a page has been selected, we inspect its reference bit. If the value is 0, we proceed to replace this page, otherwise, we give the page a second chance and move on to select the next FIFO page When a page get a second chance, it’s reference bit is cleared, and its arrival time is reset to the current time

Second-Chance Algorithm When a page get a second chance, it’s reference bit is cleared, and its arrival time is reset to the current time If a page is used often enough to keep its reference bit set, it will never be replaced

Second-Chance Algorithm One way to implement the second-chance algorithm is as a circular queue In the worst case, when all bits are set, the pointer cycles through the whole queue, giving each page a second chance Enhanced second-chance algorithm

Second-Chance Algorithm

Additional-Reference-Bits Algorithm We can gain additional ordering information by recording the reference bits at regular intervals. We can keep 8-bit byte for each page in a table in memory The OS shifts the reference bit for each page into the high-order bit of its 8-bit byte, shifting the other bit right by 1 bit and discard the low-order bit

Additional-Reference-Bits Algorithm For example: means the page has not been used for eight-time interval means a page that is used at least once in each period has used more recently with both value of and

Counting Based Page Replacement Least Frequently used (LFU) page- replacement algorithm Most frequently used (MFU) page- replacement algorithm

Page Buffering Algorithm We can keep some amount of frames (for example 3 frames) always free When a page fault occurs, the system does not have to wait the execution of replace algorithm. The system can load the page into free space and swapped out frames

Allocation of Frames When we have more than one processor, we need to allocate frames to each processor Two major algorithms: 1. equal allocation 2. proportional allocation

Allocation of Frames

9.6 Thrashing If the process does not have “enough” number of frames it needs to support page in active use, it will quickly page-fault If the number of frames allocated to a process falls below the minimum number required by the process, thrashing will happen Thrashing: The process spending more time paging than executing Thrashing results in severe performance problems

Thrashing If CPU utilization is too low, we increase the degree of multiprogramming by introducing a new process to the system Now, suppose that a process enters a new phase in its execution and needs more frames It causes page faults which requires paging device to swap pages in and out CPU utilization therefore decreases

Thrashing The trade off between CPU utilization and degree of multiprogramming When thrashing has occurred, system throughput plunges. The page fault rate increases tremendously As a result, no work is getting done since the processes are spending all their time paging

Thrashing As the degree of multiprogramming increases, CPU utilization also increases If the degree of multiprogramming is increased even further, thrashing sets in, and CPU utilization drops sharply Under this situation, we must decrease the degree of multiprogramming

Solution to Thrashing By considering Page-fault Frequency (PFF) This is trying to prevent thrashing Since Thrashing has a high page-fault rate, we need to control that We can establish upper and lower bounds on the desired page-fault rate

Solution to Thrashing

If the page-fault rate increases and no free frames are available, we must select some process and suspend it. The freed frames are then distributed to processes with high page-fault rates