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

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

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

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

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

Module 9: Virtual Memory

Module 9: Virtual Memory

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

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

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

Chapter 10: Virtual Memory. Background

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

Chapter 9: Virtual-Memory

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

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

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

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory

Where are we in the course?

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

CS370 Operating Systems

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

Basic Page Replacement

Chapters 9 & 10: Memory Management and Virtual Memory

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

Chapter 9: Virtual Memory

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

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory

Page Replacement Algorithms

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

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - X Deadlocks - II. Louisiana State University. Deadlocks

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

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

Operating System Concepts

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

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

CS420: Operating Systems

Principles of Operating Systems

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

CS370 Operating Systems

CS370 Operating Systems

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

CS370 Operating Systems

CSC Operating Systems Fall Lecture - XII Deadlocks - III. Tevfik Ko!ar. Louisiana State University. October 6 th, 2009

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

Chapter 10: Virtual Memory

CS307: Operating Systems

Chapter 9: Virtual Memory. 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

Overview of Mass Storage Structure

Chapter 4 Memory Management

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

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

Operating System Concepts 9 th Edition

Chapter 6: Demand Paging

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

Virtual Memory COMPSCI 386

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

Operating System - Virtual Memory

Basic Memory Management

OPERATING SYSTEM. Chapter 9: Virtual Memory

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

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

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

Virtual Memory Outline

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle

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

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo

Memory management, part 2: outline

Frequently asked questions from the previous class survey

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

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

CSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018

Virtual Memory III. Jo, Heeseung

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

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

1. Background. 2. Demand Paging

Virtual Memory Management

Chapter 8 Main Memory

Operating Systems. Operating Systems Sina Meraji U of T

Course: Operating Systems Instructor: M Umair. M Umair

Introduction to Virtual Memory Management

Virtual Memory Silberschatz: 9. Operating Systems. Autumn CS4023

Page Replacement Chap 21, 22. Dongkun Shin, SKKU

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

Lecture 14 Page Replacement Policies

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XI Deadlocks - II. University at Buffalo. Deadlocks. October 6 th, 2011

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

UNIT - IV. What is virtual memory?

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

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

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

Chapter 9: Virtual Memory

Last class: Today: Paging. Virtual Memory

Transcription:

CSC 0 - Operating Systems Spring 008 Lecture - XIV Virtual Memory - II Tevfik Ko!ar Louisiana State University March 7 th, 008 Background Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical address space can therefore be much larger than physical address space. Allows address spaces to be shared by several processes. Allows for more efficient process creation. Virtual memory can be implemented via: Demand paging Demand segmentation

Demand Paging 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 Valid-Invalid Bit With each page table entry a valid invalid bit is associated (! in-memory and legal, 0! not-in-memory or invalid) Initially valid invalid bit is set to 0 on all entries Example of a page table snapshot: Frame # M valid-invalid bit 0 page table During address translation, if valid invalid bit in page table entry is 0! page fault 0 0

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 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

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,,,,,, 5,,,,, 5 First-In-First-Out (FIFO) Algorithm Reference string:,,,,,, 5,,,,, 5 frames ( pages can be in memory at a time per process) 5 9 page faults frames FIFO Replacement Belady s Anomaly more frames! more page faults 5 5 0 page faults

Least Recently Used (LRU) Algorithm Reference string:,,,,,, 5,,,,, 5 5 5 Needs hardware assistance 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 Use Of A Stack to Record The Most Recent Page References

LRU Approximation Algorithms Reference bits byte for each page: eg. 0000 With each page associate a bit, initially = 0 When page is referenced bit set to Shift right at each time interval Replace the one with smaller value Second chance Need single 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 Second-Chance (clock) Page-Replacement Algorithm

Counting Algorithms 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 Optimal Algorithm Replace page that will not be used for longest period of time frames example,,,,,, 5,,,,, 5 6 page faults 5 How do you know this? Used for measuring how well your algorithm performs

Acknowledgements Operating Systems Concepts book and supplementary material by A. Silberschatz, P. Galvin and G. Gagne Operating Systems: Internals and Design Principles book and supplementary material by W. Stallings Modern Operating Systems book and supplementary material by A. Tanenbaum R. Doursat and M. Yuksel from UNR 5