Page Replacement Algorithms Memory Management. Optimal Page Replacement ▪The label for each page in memory is labeled with the number of instructions.

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

9.4 Page Replacement What if there is no free frame?
4.4 Page replacement algorithms
Page Replacement Algorithms
Chapter 3.3 : OS Policies for Virtual Memory
Virtual Memory 3 Fred Kuhns
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Page Replacement Algorithms
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
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  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 Introduction to Operating Systems: Module 9.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management – 4 Page Replacement Algorithms CS 342 – Operating Systems.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Virtual Memory Chapter 8.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Memory Management Virtual Memory Page replacement algorithms
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.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
CSCI2413 Lecture 6 Operating Systems Memory Management 2 phones off (please)
CS 333 Introduction to Operating Systems Class 14 – Page Replacement Jonathan Walpole Computer Science Portland State University.
CSC 322 Operating Systems Concepts Lecture - 15: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Maninder Kaur VIRTUAL MEMORY 24-Nov
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Virtual Memory.
O RERATıNG S YSTEM LESSON 10 MEMORY MANAGEMENT II 1.
Memory Management Page replacement algorithms, segmentation Tanenbaum, ch. 3 p Silberschatz, ch. 8, 9 p
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 First-in, First-out Remove the oldest page Determine the age based on the loading time, not on the time being referenced Old pages may be heavily used.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Paging.
Virtual Memory Virtual Memory is created to solve difficult memory management problems Data fragmentation in physical memory: Reuses blocks of memory.
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.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
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.
Demand Paging Reference Reference on UNIX memory management
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.
Operating Systems Practical Session 10, Memory Management continues.
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.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
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.
PAGE REPLACEMNT ALGORITHMS FUNDAMENTAL OF ALGORITHMS.
COS 318: Operating Systems Virtual Memory Paging.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Chapter 9: Virtual-Memory Management
5: Virtual Memory Background Demand Paging
Virtual Memory Management
Practical Session 8, Memory Management 2
Operating Systems CMPSC 473
Operating Systems Concepts
Module 9: Virtual Memory
Chapter 9: Virtual Memory CSS503 Systems Programming
Practical Session 9, Memory Management continues
Virtual Memory.
Presentation transcript:

Page Replacement Algorithms Memory Management

Optimal Page Replacement ▪The label for each page in memory is labeled with the number of instructions that will be executed before that page is first referenced. ▪Replace the page with the highest number: i.e. postpone as much as possible the next page fault. ▪The OS can’t look into the future to know how long it’ll take to reference every page again.

NRU (Not Recently Used) ▪Keep one bit called the "used bit" or "reference bit", where 1 => used recently and 0 => not used recently. ▪Variants of this scheme are used in many operating systems, including UNIX and Macintosh. ▪3 variations of NRU: Variation 1: If the requested page is in memory already, change its used bit as 1, otherwise, execute the following algorithm. Variation 3: Reset all bits to zero on a regular interval, say 60 times/second. Variation 4: Keep several bits, say 32 bits, to represent the history of usage of the page. When a page is chosen, it is replaced with the new page and the used bits are cleared, except for the leftmost bit.

FIFO, has the pages in a Linked-List On a page fault, the oldest page will be dropped, while the newest is added to the end Second chance solves an issue that occurs in FIFO A Reference bit is used to indicate the page has been used If 0 the page is replaced If 1, the R bit is cleared and set to 0 and the load time is updated First-In, First-Out The Second-Chance Page Replacement

LRU (Least Recently Used) ▪Each page has a counter. ▪After every ‘x’ amount of time, every page that ran during the time interval increments the counter by 1. ▪Page with lowest counter is swapped out when necessary. ▪Downside: Does not put into account how long the page ran during the time interval. ▪Discards the least recently used items first. ▪LRU is implemented by a double linked list. ▪When a page in the list is accessed, it will be moved from its place to the end of the list. ▪Downside: Expensive and difficult to implement. NFU (Not Frequently Used)

NFU’s Aging Modification ▪Modification of NFU. ▪Involves the shifting of reference bits. ▪Each counter shifts right one bit before the reference bit. ▪Reference bit then shifts to the left most bit. ▪If there’s a page fault, the page with the lowest counter will be replaced.

Working Set and WSClock ▪Pages being used by a process. ▪If entire WS is in the memory then no page faults. ▪Algorithm used to make sure working set is in memory. ▪Time of last used. ▪Improvement of WS page replacement algorithm. ▪Circular list for each entry. ▪Time of last used. WS Clock Algorithm

Virtual Memory ▪Virtual memory is a feature of an operating system (OS) that allows a computer to compensate for shortages of physical memory. ▪When an instruction is needed by the program it is transferred from virtual memory to physical. ▪Advantages: Efficient and cheap and programmers can work being aware of just the LOGICAL MEMORY→ (Combination of physical memory and the hard disk space acting as memory) ▪Two methods of transferring data: ▪Paging: Fixed Block Size, Single Address Space and Stored Contiguously. ▪Segmentation: Variable Block Size, Double Address Space, Stored in Logical Groups. PagingSegmentation

Video:

Bibliography ▪ your second bullet point here ▪ ▪ ▪ aging-page-replacement-algorithmhttp:// aging-page-replacement-algorithm ▪ ▪ ▪ ▪ ▪ algorithm