Basic Page Replacement

Similar documents
OPERATING SYSTEM - VIRTUAL MEMORY

Operating Systems. Virtual Memory

Virtual Memory Paging

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1)

Operating Systems, 6 th ed. Test Bank Chapter 7

Chapter 12. Paging an Virtual Memory Systems

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Virtual vs Physical Addresses

Computer Architecture

Chapter 7 Memory Management

HY345 Operating Systems

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet.

Lecture 17: Virtual Memory II. Goals of virtual memory

Far-western University Central Office, Mahendranagar Operating System

Memory Management CS 217. Two programs can t control all of memory simultaneously

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

OS OBJECTIVE QUESTIONS

W4118 Operating Systems. Instructor: Junfeng Yang

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

Chapter 11: File System Implementation. Chapter 11: File System Implementation. Objectives. File-System Structure

Operating System: Scheduling

Memory Management under Linux: Issues in Linux VM development

Computer Science 4302 Operating Systems. Student Learning Outcomes

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Chapter 10: Virtual Memory. Lesson 08: Demand Paging and Page Swapping

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

CS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement

The Classical Architecture. Storage 1 / 36

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Buffer Management 5. Buffer Management

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

Comparison between scheduling algorithms in RTLinux and VxWorks

Chapter 11 I/O Management and Disk Scheduling

CS5460: Operating Systems

Chapter 7 Memory Management

Chapter 11 I/O Management and Disk Scheduling

OPERATING SYSTEM - MEMORY MANAGEMENT

Garbage Collection in the Java HotSpot Virtual Machine

Linux VM Infrastructure for memory power management

COS 318: Operating Systems

Devices and Device Controllers

Midterm Exam #2 Solutions November 10, 1999 CS162 Operating Systems

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Chapter 12 File Management

Operating Systems. RAID Redundant Array of Independent Disks. Submitted by Ankur Niyogi 2003EE20367

KVM & Memory Management Updates

File Management. Chapter 12

Operating Systems. Steven Hand. Michaelmas / Lent Term 2008/ lectures for CST IA. Handout 3. Operating Systems N/H/MWF@12

Parallel Databases. Parallel Architectures. Parallelism Terminology 1/4/2015. Increase performance by performing operations in parallel

Presentation of Diagnosing performance overheads in the Xen virtual machine environment

OPERATING SYSTEMS MEMORY MANAGEMENT

Comparison of Memory Management Systems of BSD, Windows, and Linux

General Purpose Operating System Support for Multiple Page Sizes

Chapter 1 13 Essay Question Review

Operating System Structures

How To Write A Virtual Machine (Or \"Virtual Machine\") On A Microsoft Linux Operating System (Or Microsoft) (Or Linux) ( Or Microsoft Microsoft Operating System) (For A Non-Power Os) (On A

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Kernel Optimizations for KVM. Rik van Riel Senior Software Engineer, Red Hat June

COS 318: Operating Systems. Virtual Memory and Address Translation

Maximizing VMware ESX Performance Through Defragmentation of Guest Systems. Presented by

Board Notes on Virtual Memory

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

Chapter 11: File System Implementation. Operating System Concepts with Java 8 th Edition

Operating System Tutorial

Storage in Database Systems. CMPSCI 445 Fall 2010

Midterm Exam #2 November 10, 1999 CS162 Operating Systems

Chapter 10 Case Study 1: LINUX

Managing Prefetch Memory for Data-Intensive Online Servers

Chapter 12 File Management

Chapter 12 File Management. Roadmap

How To Understand And Understand An Operating System In C Programming

Reliability and Fault Tolerance in Storage

Computer-System Architecture

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

An Implementation Of Multiprocessor Linux

- An Essential Building Block for Stable and Reliable Compute Clusters

Managing Storage Space in a Flash and Disk Hybrid Storage System

COS 318: Operating Systems

1. Introduction to the UNIX File System: logical vision

The World According to the OS. Operating System Support for Database Management. Today s talk. What we see. Banking DB Application

Local and Remote Memory: Memory in a Linux/NUMA System

Lecture 1: Data Storage & Index

Peter J. Denning, Naval Postgraduate School, Monterey, California

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Operating Systems 4 th Class

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

System Software Prof. Dr. H. Mössenböck

Shrimad Rajchandra Institute of Management & Computer Application

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Performance Monitor for AutoCAD

W4118: segmentation and paging. Instructor: Junfeng Yang

Transcription:

Basic Page Replacement 1. 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 3. Bring the desired page into the (newly) free frame; update the page and frame tables 4. Restart the process Use modify (dirty) bit to reduce overhead of page transfers only modified pages are written to disk 9.1 Silberschatz, Galvin and Gagne

Page Replacement 9. Silberschatz, Galvin and Gagne

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 9.3 Silberschatz, Galvin and Gagne

First-In-First-Out Page Replacement 9.4 Silberschatz, Galvin and Gagne

First-In-First-Out (FIFO) Algorithm Reference string: 1,, 3, 4, 1,, 5, 1,, 3, 4, 5 3 frames (3 pages can be in memory at a time per process) 1 1 4 5 1 3 9 page faults 4 frames 3 3 4 1 1 5 4 1 5 10 page faults 3 3 4 4 3 Belady s Anomaly: more frames more page faults 9.5 Silberschatz, Galvin and Gagne

FIFO Illustrating Belady s Anomaly 9.6 Silberschatz, Galvin and Gagne

Optimal Algorithm Replace page that will not be used for longest period of time 4 frames example 1,, 3, 4, 1,, 5, 1,, 3, 4, 5 1 4 6 page faults 3 4 5 How do you know this? Used for measuring how well your algorithm performs 9.7 Silberschatz, Galvin and Gagne

Optimal Page Replacement 9.8 Silberschatz, Galvin and Gagne

Least Recently Used (LRU) Algorithm Reference string: 1,, 3, 4, 1,, 5, 1,, 3, 4, 5 1 1 1 1 5 3 5 5 4 4 Counter implementation 4 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 Stack implementation keep a stack of page numbers in a double link form: Page referenced move it to the top No search for replacement 4 3 3 3 9.9 Silberschatz, Galvin and Gagne

LRU Page Replacement 9.10 Silberschatz, Galvin and Gagne

Allocation of Frames Each process needs minimum number of pages Example: IBM 370 6 pages to handle SS MOVE instruction: instruction is 6 bytes, might span pages pages to handle from pages to handle to 9.11 Silberschatz, Galvin and Gagne

Fixed Allocation Equal allocation For example, if there are 100 frames and 5 processes, give each process 0 frames. Proportional allocation Allocate according to the size of process s size of process p S s a i i i m total number of allocation for m 64 s s a a i 1 10 17 p i i frames si m S 10 64 5 137 17 64 59 137 9.1 Silberschatz, Galvin and Gagne

Global vs. Local Allocation Global replacement process selects a replacement frame from the set of all frames; one process can take a frame from another Local replacement each process selects from only its own set of allocated frames 9.13 Silberschatz, Galvin and Gagne

Thrashing If a process does not have enough pages, the page-fault rate is very high. This leads to: low CPU utilization operating system thinks that it needs to increase the degree of multiprogramming Thrashing a process is busy swapping pages in and out 9.14 Silberschatz, Galvin and Gagne

Demand Paging and Thrashing Why does demand paging work? Locality model Process migrates from one locality to another Localities may overlap Why does thrashing occur? size of locality > total memory size 9.15 Silberschatz, Galvin and Gagne

Page-Fault Frequency Scheme Establish acceptable page-fault rate If actual rate too low, process loses frame If actual rate too high, process gains frame 9.16 Silberschatz, Galvin and Gagne

Allocating Kernel Memory Treated differently from user memory Often allocated from a free-memory pool Kernel requests memory for structures of varying sizes Some kernel memory needs to be contiguous 9.17 Silberschatz, Galvin and Gagne

Buddy System Allocates memory from fixed-size segment consisting of physicallycontiguous pages Memory allocated using power-of- allocator Satisfies requests in units sized as power of Request rounded up to next highest power of When smaller allocation needed than is available, current chunk split into two buddies of next-lower power of Continue until appropriate sized chunk available 9.18 Silberschatz, Galvin and Gagne

Buddy System Allocator 9.19 Silberschatz, Galvin and Gagne

Other Issues -- Prepaging Prepaging To reduce the large number of page faults that occurs at process startup Prepage all or some of the pages a process will need, before they are referenced But if prepaged pages are unused, I/O and memory was wasted 9.0 Silberschatz, Galvin and Gagne

Other Issues Page Size Page size selection must take into consideration: fragmentation table size I/O overhead locality 9.1 Silberschatz, Galvin and Gagne

Other Issues TLB Reach TLB Reach - The amount of memory accessible from the TLB TLB Reach = (TLB Size) X (Page Size) Ideally, the working set of each process is stored in the TLB Otherwise there is a high degree of page faults Increase the Page Size This may lead to an increase in fragmentation as not all applications require a large page size Provide Multiple Page Sizes This allows applications that require larger page sizes the opportunity to use them without an increase in fragmentation 9. Silberschatz, Galvin and Gagne

Other Issues Program Structure Program structure Int[18,18] data; Each row is stored in one page Program 1 for (j = 0; j <18; j++) for (i = 0; i < 18; i++) data[i,j] = 0; 18 x 18 = 16,384 page faults Program for (i = 0; i < 18; i++) for (j = 0; j < 18; j++) data[i,j] = 0; 18 page faults 9.3 Silberschatz, Galvin and Gagne

Other Issues I/O interlock I/O Interlock Pages must sometimes be locked into memory Consider I/O - Pages that are used for copying a file from a device must be locked from being selected for eviction by a page replacement algorithm 9.4 Silberschatz, Galvin and Gagne

Reason Why Frames Used For I/O Must Be In Memory 9.5 Silberschatz, Galvin and Gagne

End of Chapter 9 Silberschatz, Galvin and Gagne