Demand Paging. Valid-Invalid Bit. Steps in Handling a Page Fault. Page Fault. Transfer of a Paged Memory to Contiguous Disk Space

Similar documents
Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007

Chapter 10: Virtual Memory. Background

Chapter 10: Virtual Memory. Background. Demand Paging. Valid-Invalid Bit. Virtual Memory That is Larger Than Physical Memory

Module 9: Virtual Memory

Module 9: Virtual Memory

Chapter 9: Virtual-Memory Management. Operating System Concepts 8 th Edition,

Where are we in the course?

CSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008.

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory. Chapter 9: Virtual Memory. Objectives. Background. Virtual-address address Space

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - XIV Virtual Memory - I. Louisiana State University.

Virtual Memory - I. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XV. University at Buffalo.

Virtual Memory - I. Roadmap. Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012

Chapter 3: Virtual Memory ว ตถ ประสงค. Background สามารถอธ บายข อด ในการท ระบบใช ว ธ การจ ดการหน วยความจ าแบบเสม อนได

Chapter 9: Virtual Memory

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition

Chapter 8: Virtual Memory. Operating System Concepts

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles

Chapter 9: Virtual-Memory

Background. Virtual Memory (2/2) Demand Paging Example. First-In-First-Out (FIFO) Algorithm. Page Replacement Algorithms. Performance of Demand Paging

Chapters 9 & 10: Memory Management and Virtual Memory

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging

CS307: Operating Systems

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

CS370 Operating Systems

Operating System Concepts

Memory Management. Virtual Memory. By : Kaushik Vaghani. Prepared By : Kaushik Vaghani

Virtual Memory Outline

OPERATING SYSTEM. Chapter 9: Virtual Memory

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory

CSE325 Principles of Operating Systems. Virtual Memory. David P. Duggan. March 7, 2013

Principles of Operating Systems

CS420: Operating Systems

Chapter 10: Virtual Memory

Chapter 9: Virtual Memory. Operating System Concepts 9th Edition

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

Operating System Concepts 9 th Edition

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs

CS370 Operating Systems

현재이이미지를표시할수없습니다. Chapter 9: Virtual Memory

Chapter 6: Demand Paging

Virtual Memory: Page Replacement. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

Basic Page Replacement

Virtual Memory COMPSCI 386

First-In-First-Out (FIFO) Algorithm

ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems ( ) Chapter 6: Demand Paging

Operating Systems. Overview Virtual memory part 2. Page replacement algorithms. Lecture 7 Memory management 3: Virtual memory

CS370 Operating Systems

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

ECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I)

Page Replacement Algorithms

Page Replacement Chap 21, 22. Dongkun Shin, SKKU

Chapter 9: Virtual Memory

Basic Memory Management

Virtual Memory - Overview. Programmers View. Virtual Physical. Virtual Physical. Program has its own virtual memory space.

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Chapter 8: Main Memory. Operating System Concepts 8th Edition

UNIT - IV. What is virtual memory?

Topics: Virtual Memory (SGG, Chapter 09) CS 3733 Operating Systems

Operating System - Virtual Memory

CS370 Operating Systems

Introduction to Virtual Memory Management

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo

Chapter 4 Memory Management

Virtual Memory III. Jo, Heeseung

Virtual Memory B: Objec5ves

VII. Memory Management

Page Replacement Chap 21, 22. Dongkun Shin, SKKU

CS 3733 Operating Systems:

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle

Virtual Memory. 1 Administrivia. Tom Kelliher, CS 240. May. 1, Announcements. Homework, toolboxes due Friday. Assignment.

Memory Management and Protection

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Operating Systems. Paging... Memory Management 2 Overview. Lecture 6 Memory management 2. Paging (contd.)

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Virtual Memory - II. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XVI. University at Buffalo.

Memory management, part 2: outline

MEMORY MANAGEMENT/1 CS 409, FALL 2013

Lecture 14 Page Replacement Policies

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.

Virtual Memory CHAPTER CHAPTER OBJECTIVES. 8.1 Background

Last class: Today: Paging. Virtual Memory

1. Background. 2. Demand Paging

Even in those cases where the entire program is needed, it may not all be needed at the same time (such is the case with overlays, for example).

Virtual Memory Management

VIRTUAL MEMORY READING: CHAPTER 9

Memory Management Virtual Memory

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.

Chapter 8 Virtual Memory

Transcription:

Demand Paging Transfer of a Paged Memory to Contiguous Disk Space Bring a page into memory only when it is needed. Less I/O needed Less memory needed Faster response More users Page is needed reference to it invalid reference abort not-in-memory bring to memory 0. 0. Valid-Invalid Bit Page Table When Some Pages Are Not in Main Memory With each page table entry a valid invalid bit is associated ( in-memory, 0 not-in-memory) Initially valid invalid but is set to 0 on all entries. Example of a page table snapshot. Frame # valid-invalid bit 0 M 0 0 page table During address translation, if valid invalid bit in page table entry is 0 page fault. 0.6 0.7 Page Fault Steps in Handling a Page Fault If there is ever a reference to a page, first reference will trap to OS page fault OS looks at another table to decide: Invalid reference abort. Just not in memory. Get empty frame. Swap page into frame. Reset tables, validation bit =. Restart instruction: Least Recently Used block move auto increment/decrement location 0.8 0.9

What happens if there is no free frame? Performance of Demand Paging Page replacement find some page in memory, but not really in use, swap it out. algorithm performance want an algorithm which will result in minimum number of page faults. Same page may be brought into memory several times. Page Fault Rate 0 p.0 if p = 0 no page faults if p =, every reference is a fault Effective Access Time (EAT) EAT = ( p) x memory access + p (page fault overhead + [swap page out ] + swap page in + restart overhead) 0.0 0. Demand Paging Example Process Creation Memory access time = microsecond 0% of the time the page that is being replaced has been modified and therefore needs to be swapped out. Swap Page Time = 0 msec = 0,000 microsec EAT = ( p) x + p (000) + 000P (in microsec) Virtual memory allows other benefits during process creation: - Copy-on-Write - Memory-Mapped Files 0. 0. Copy-on-Write Memory-Mapped Files Copy-on-Write (COW) allows both parent and child processes to initially share the same pages in memory. If either process modifies a shared page, only then is the page copied. COW allows more efficient process creation as only modified pages are copied. Free pages are allocated from a pool of zeroed-out pages. Memory-mapped file I/O allows file I/O to be treated as routine memory access by mapping a disk block to a page in memory. A file is initially read using demand paging. A page-sized portion of the file is read from the file system into a physical page. Subsequent reads/writes to/from the file are treated as ordinary memory accesses. Simplifies file access by treating file I/O through memory rather than read() write() system calls. Also allows several processes to map the same file allowing the pages in memory to be shared. 0. 0.

Memory Mapped Files Page Replacement Prevent over-allocation of memory by modifying pagefault service routine to include page replacement. Use modify (dirty) bit to reduce overhead of page transfers only modified pages are written to disk. Page replacement completes separation between logical memory and physical memory large virtual memory can be provided on a smaller physical memory. 0.6 0.7 Need For Page Replacement Basic Page Replacement Find the location of the desired page on disk. Find a free frame: - If there is a free frame, use it. - If there is no free frame, use a page replacement algorithm to select a victim frame. Read the desired page into the (newly) free frame. Update the page and frame tables. Restart the process. 0.8 0.9 Page Replacement Page Replacement Algorithms Want lowest page-fault rate. Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string. In all our examples, the reference string is,,,,,,,,,,,. 0.0 0.

Graph of Page Faults Versus The Number of Frames First-In-First-Out (FIFO) Algorithm Reference string:,,,,,,,,,,, frames ( pages can be in memory at a time per process) 9 page faults frames 0 page faults FIFO Replacement Belady s Anomaly more frames less page faults 0. 0. FIFO Page Replacement FIFO Illustrating Belady s Anamoly 0. 0. Optimal Algorithm Optimal Page Replacement Replace page that will not be used for longest period of time. frames example,,,,,,,,,,, 6 page faults How do you know this? Used for measuring how well your algorithm performs. 0.6 0.7

Least Recently Used (LRU) Algorithm LRU Page Replacement Reference string:,,,,,,,,,,, Counter implementation Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter. When a page needs to be changed, look at the counters to determine which are to change. 0.8 0.9 LRU Algorithm (Cont.) Use Of A Stack to Record The Most Recent Page References Stack implementation keep a stack of page numbers in a double link form: Page referenced: move it to the top requires 6 pointers to be changed No search for replacement 0.0 0. LRU Approximation Algorithms Second-Chance (clock) Page-Replacement Algorithm Reference bit With each page associate a bit, initially = 0 When page is referenced bit set to. Replace the one which is 0 (if one exists). We do not know the order, however. Second chance Need reference bit. Clock replacement. If page to be replaced (in clock order) has reference bit =. then: set reference bit 0. leave page in memory. replace next page (in clock order), subject to same rules. 0. 0.

Counting Algorithms Allocation of Frames Keep a counter of the number of references that have been made to each page. LFU Algorithm: replaces page with smallest count. MFU Algorithm: based on the argument that the page with the smallest count was probably just brought in and has yet to be used. Each process needs minimum number of pages. Example: IBM 70 6 pages to handle SS MOVE instruction: instruction is 6 bytes, might span pages. pages to handle from. pages to handle to. Two major allocation schemes. fixed allocation priority allocation 0. 0. 6