By Andrew Yee. Virtual Memory Memory Management What is Page Replacement?

Slides:



Advertisements
Similar presentations
CS 241 Spring 2007 System Programming 1 Memory Replacement Policies Lecture 32 Klara Nahrstedt.
Advertisements

Page Replacement Algorithms
Cache and Virtual Memory Replacement Algorithms
Scribe for 7 th April 2014 Page Replacement Algorithms Payal Priyadarshini 11CS30023.
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Using one level of Cache:
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Memory Problems Prof. Sin-Min Lee Department of Mathematics and Computer Sciences.
1 Virtual Memory Sample Questions Project 3 – Build Pthread Lib Extra Office Hour: Wed 4pm-5pm HILL 367 Recitation 6.
Ecole Polytechnique, Nov 7, Online Job Scheduling Marek Chrobak University of California, Riverside.
Lecture 33: Chapter 5 Today’s topic –Cache Replacement Algorithms –Multi-level Caches –Virtual Memories 1.
Maninder Kaur CACHE MEMORY 24-Nov
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
Maninder Kaur VIRTUAL MEMORY 24-Nov
Chapter VIII Virtual Memory Review Questions Jehan-François Pâris
Cache performance CS 147 Prof. Lee Hai Lin Wu Cache performance  Introduction  Primary components –Cache hits Hit ratio –Cache misses  Average memory.
Chapter 21 Virtual Memoey: Policies Chien-Chung Shen CIS, UD
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
Page Replacement Algorithms and Simulation Neville Allen.
1 Project: Page Replacement Algorithms Lubomir Bic.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Memory Management & Virtual Memory © Dr. Aiman Hanna Department of Computer Science Concordia University Montreal, Canada.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
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.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
1  2004 Morgan Kaufmann Publishers Locality A principle that makes having a memory hierarchy a good idea If an item is referenced, temporal locality:
Saket Mengle Paging refers to the process of managing program access to virtual memory pages that do not currently reside in RAM.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Cache memory Replacement Policy Prof. Sin-Min Lee Department of Computer Science.
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.
CS422 Principles of Database Systems Buffer Management Chengyu Sun California State University, Los Angeles.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Chapter 9 Memory Organization. 9.1 Hierarchical Memory Systems Figure 9.1.
Page Replacement FIFO, LIFO, LRU, NUR, Second chance
1.Why we need page replacement? 2.Basic page replacement technique. 3.Different type of page replacement algorithm and their examples.
COS 318: Operating Systems Virtual Memory Paging.
CS161 – Design and Architecture of Computer
Memory Management (2).
CS161 – Design and Architecture of Computer
Computer Architecture
Chapter 21 Virtual Memoey: Policies
Replacement Policy Replacement policy:
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Morgan Kaufmann Publishers
Chapter 9: Virtual-Memory Management
CGS 3763 Operating Systems Concepts Spring 2013
Chapter 5 Memory CSE 820.
Memory Management & Virtual Memory
Lecture 39 Syed Mansoor Sarwar
What Happens if There is no Free Frame?
Virtual Memory فصل هشتم.
Chap. 12 Memory Organization
CS 140 Lecture Notes: Demand Paging
Contents Memory types & memory hierarchy Virtual memory (VM)
CS 140 Lecture Notes: Demand Paging
Exercise (11).
Exercise (10).
Jazan University, Jazan KSA
Module IV Memory Organization.
Module IV Memory Organization.
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
CGS 3763 Operating Systems Concepts Spring 2013
Sarah Diesburg Operating Systems CS 3430
Chapter Contents 7.1 The Memory Hierarchy 7.2 Random Access Memory
Module IV Memory Organization.
Presentation transcript:

by Andrew Yee

Virtual Memory Memory Management What is Page Replacement?

Why Page Replacement? Cache is limited Need ways to manage virtual memory in Cache

Cache is limited small, you have to figure out ways to choose which pages to keep in cache. Which you think would most likely be used again in the future. FIFO and LRU are techniques used to determine which pages should be kept cache. Optimal is the best possible outcome because you use future knowledge which pages will be used again to determine which pages to keep. How to Page Replace? 3 Ways to manage Virtual Memory in Cache 1.Optimal – Best possible outcome 2.LRU - Least Recently Used 3.FIFO - First In First Out Think “Stacks”

How to Represent Pages in Time? Think Animated “Stacks” 123 Time increases CPU issues the page reference string. Frame cell that can hold a page reference string. Frame set that can 3 page reference string.

How to Represent Page Hit and Page Fault (miss)? Think Animated “Stacks” 1234 Time increases Page Fault (miss) – box the frame set Page Hit – Don’t box the frame set

Optimal Method What you need? Requires Future Knowledge.

Example of Optimal Method Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page –Page Fault (Missed)

FIFO – First in First Out Method How? First Page In First Page Out

Example of FIFO Method Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page –Page Fault (Missed)

LRU – Least Recently Used Key to this method is: Past experience may indicate future behavior

Example of LRU Method Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page –Page Fault (Missed)

Page Fault Comparison Methods# of Page Fault Optimal 5 FIFO – First In First Out 9 LRU – Least Recently Used 7

Practical Method Comparison Methods# of Page FaultWhat we Need? Optimal 5 Future Knowledge FIFO – First In First Out 9 1 st page LRU – Least Recently Used 7 Past Experience

Hit Ratio Hit Ratio = (Total # of Frame Set - # of Page Fault) * 100 Total # of Frame Set

Hit Ratio Methods# of Page FaultTotal # of Frame SetHit Ratio Optimal 5 14 (14-5)/14* 100 = 9/14 *100 = 64.29% FIFO – First In First Out % LRU – Least Recently Used %

Practice Example Compute the hit ratio of each method: – Optimal, FIFO, LRU 13364

Practice Example Compute the hit ratio of each method: – Optimal Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%

Practice Example Compute the hit ratio of each method: – FIFO Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%

Practice Example Compute the hit ratio of each method: – LRU Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%