Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.Why we need page replacement? 2.Basic page replacement technique. 3.Different type of page replacement algorithm and their examples.

Similar presentations


Presentation on theme: "1.Why we need page replacement? 2.Basic page replacement technique. 3.Different type of page replacement algorithm and their examples."— Presentation transcript:

1

2 1.Why we need page replacement? 2.Basic page replacement technique. 3.Different type of page replacement algorithm and their examples.

3 Limited physical memory --> limited number of frame --> limited number of frame allocated to a process.

4 1.Find the location of the desired page on the disk. 2.Find a free frame If there is a free frame use it. No free frame – use page replacement algorithm to select a victim frame. Write the victim frame to disk, change the frame and page tables accordingly.

5 Which page to be replaced? Page removed should be the page least likely to be referenced in the near future. Most policies predict the future behavior on the basis of past behavior.

6 1.FIFO page replacement 2.Optimal page replacement 3.LRU page replacement 4.LRU-Approximation page replacement 5.Counting-Based page replacement

7 70120304230321201701 String Reference 77 0 7 1 0 0 1 2 0 1 2 1 2 3 2 3 0 3 0 4 4 3 2 2 3 0 2 3 0 2 3 0 0 1 2 0 1 2 0 1 2 7 7 7 7 7 7 0 4 2 3 0 1 7 7 7 ************ Young page Old Page Frames initially empty Page faults

8 FIFO is similar to First In First Out CPU scheduling algorithm wherein the requested page is loaded first and subsequent fetches are also serviced in order of request arrival. A page which is being accessed quite often may also get replaced because it arrived earlier than those present Ignores locality of reference. A page which was referenced last may also get replaced, although there is high probability that the same page may be needed again.

9 77 0 7 1 0 0 1 2 0 1 2 1 2 3 2 3 0 3 0 4 4 3 2 2 3 0 2 3 0 2 3 0 0 1 2 0 1 2 0 1 2 7 7 7 7 7 7 0 4 2 3 0 1 7 7 7 ************ pf/n pf = page faults N = number of reference made 12/20 = 60% 70120304230321201701

10 The main idea of OPT is to replace the pages found n the frames that re not going to be used/ referenced soon. An optimal page-replacement algorithm has the lowest page-fault rate of all algorithms (called OPT or MIN). It is simply this: Replace the page that will not be used for the longest period of time. - At the moment of page fault: Label 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

11 77 0 7 1 0 0 1 2 0 1 2 0 2 3 0 3 0 4 2 3 4 2 3 0 2 3 0 2 3 0 2 3 2 0 1 0 1 2 0 1 2 0 1 7 0 1 7 4 2 3 2 0 1 0 1 7 ***** 70120304230321201701 * pf/n pf = page faults N = number of reference made 6/20 = 30%

12 This algorithm reposes on the opposite of the concept of temporal locality, wherein if a page has not been referenced for quite some time then it is not going to be referenced in the future.

13 77 0 7 0 1 0 1 2 1 2 0 2 0 3 2 3 0 3 0 4 4 2 3 2 3 0 2 3 0 0 3 2 3 1 2 1 2 0 2 0 1 0 7 1 1 7 0 2 4 2 3 2 1 7 0 1 ********* 70120304230321201701 Pf/N 9 / 20 = 45%


Download ppt "1.Why we need page replacement? 2.Basic page replacement technique. 3.Different type of page replacement algorithm and their examples."

Similar presentations


Ads by Google