PAGE REPLACEMNT ALGORITHMS FUNDAMENTAL OF ALGORITHMS.

Slides:



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

Chapter 4 Memory Management Basic memory management Swapping
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.
4.4 Page replacement algorithms
Chapter 3.3 : OS Policies for Virtual Memory
Chapter 11 – Virtual Memory Management
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Virtual Memory 3 Fred Kuhns
Memory Management.
Page Replacement Algorithms
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
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.
Virtual Memory Introduction to Operating Systems: Module 9.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
1 Memory Management Managing memory hierarchies. 2 Memory Management Ideally programmers want memory that is –large –fast –non volatile –transparent Memory.
Day 23 Virtual Memory. Operating system’s role in VM Hardware-support Use VM or not Use paging or segmentation or both Software domain Algorithms for.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management – 4 Page Replacement Algorithms CS 342 – Operating Systems.
Chapter 11 – Virtual Memory Management Outline 11.1 Introduction 11.2Locality 11.3Demand Paging 11.4Anticipatory Paging 11.5Page Replacement 11.6Page Replacement.
Introduction to Systems Programming Lecture 7
1 Lecture 9: Virtual Memory Operating System I Spring 2007.
Memory Management Virtual Memory Page replacement algorithms
CSI 400/500 Operating Systems Spring 2009 Lecture #9 – Paging and Segmentation in Virtual Memory Monday, March 2 nd and Wednesday, March 4 th, 2009.
1 Virtual Memory Sample Questions Project 3 – Build Pthread Lib Extra Office Hour: Wed 4pm-5pm HILL 367 Recitation 6.
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.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
Demand Paging Virtual memory = indirect addressing + demand paging –Without demand paging, indirect addressing by itself is valuable because it reduces.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement Jonathan Walpole Computer Science Portland State University.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
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
Operating Systems Unit 8: – Virtual Memory management Operating Systems.
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
Chapter 21 Virtual Memoey: Policies Chien-Chung Shen CIS, UD
Page Replacement Algorithms Memory Management. Optimal Page Replacement ▪The label for each page in memory is labeled with the number of instructions.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Demand Paging Reference Reference on UNIX memory management
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.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
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.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
1 Memory Management Chapter Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Virtual Memory. 2 Last Week Memory Management Increase degree of multiprogramming –Entire process needs to fit into memory Dynamic Linking and Loading.
Page Replacement FIFO, LIFO, LRU, NUR, Second chance
COS 318: Operating Systems Virtual Memory Paging.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Memory Management (2).
ITEC 202 Operating Systems
Day 22 Virtual Memory.
Demand Paging Reference Reference on UNIX memory management
Lecture 10: Virtual Memory
Demand Paging Reference Reference on UNIX memory management
Chapter 9: Virtual-Memory Management
Demand Paged Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Practical Session 8, Memory Management 2
Page Replacement FIFO, LIFO, LRU, NUR, Second chance
Operating Systems Concepts
Practical Session 9, Memory Management continues
Presentation transcript:

PAGE REPLACEMNT ALGORITHMS FUNDAMENTAL OF ALGORITHMS

What is PAGING? Pages are certain fixed size memory block. Virtual Memory is the replacing physical memory with virtual pages. Pages written on secondary memory. Used when there is shortage of physical memory.

PAGE REPLACEMNENT When a page fault occurs, the operating system has to choose a page to remove from memory to make room for the page that has to be brought in. A page fault is an exception raised by the hardware, when a program accesses a page that is mapped in address space, but not loaded in physical memory.

Page Fault Handling A page to be removed can be selected randomly, or by using any algorithm. Similar Problems in: - Memory Cache - Webservers There are many algorithms available for replacing a page.

Optimal Page Replacement Algorithm Best possible algorithm but not real. Replace page which: - Never be needed again - Will be needed farthest point in future Non Real

LRU Algorithm LRU(Least Recently Used) assume pages used recently (arranged in linked list) will used again soon. R(Reference) and M(Modified) Bit Class 0:Not referenced,not modified Class 1:Not referenced, modified Class 3: referenced, not modified Class 4: referenced, modified Throw out page that has been unused for longest time on the basis of R and M bits. Modrately Efficient, not optimal.

FIFO Page Replacement Algorithm Pages in memory are maintained in a linked list (a queue). –The page at the head is the oldest one. –The page at the tail is the newest one. Algorithm: –When necessary, evict the page at the head of the list. Add the new page to the tail of the list. Rarely used in its pure form

The Second Chance Page Replacement Algorithm It takes care of oldest page which has been referenced. When it decides to remove a page –1. Looks to the head of the list –2. If head has R-bit as 1, then R-bit of head is cleared and it is put to the end. If R-bits of all pages in memory are set, then this algorithm is effectively same with FIFO

The Clock Page Replacement Algorithm Better than second chance. Page frames on a circular list in the form of a clock A hand points to the oldest page.

If a page fault occurs: –1. If R bit of page pointed to by hand is 0, then remove the page; Insert the new page to the same location, Advance the hand by one position in clockwise direction. –2. If R bit is 1, then hand is advanced by one position in clockwise direction, and R bit is set to zero. Repeat step 2 until a page whose R-bit is 0 is found. Then execute step 1.

The Working Set Page Replacement Algorithm The working set is the set of pages used by the k most recent memory references w(k,t) is the size of the working set at time, t

The Working Set Page Replacement Algorithm

The WSClock Page Replacement Algorithm

Conclusions Minimize the redundant access to secondary disc. Dynamic and Static Algos

THANK YOU ASHISH SHARMA (061222) DEEP CHANDRA GUPTA (061231)