csci 3411: Operating Systems

Similar documents
Operating Systems. Virtual Memory

Virtual Memory Paging

Chapter 12. Paging an Virtual Memory Systems

OPERATING SYSTEM - VIRTUAL MEMORY

Outline. Cache Parameters. Lecture 5 Cache Operation

HY345 Operating Systems

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

Lecture 17: Virtual Memory II. Goals of virtual memory

361 Computer Architecture Lecture 14: Cache Memory

Operating Systems, 6 th ed. Test Bank Chapter 7

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

(Refer Slide Time: 00:01:16 min)

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

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

Virtual vs Physical Addresses

14.1 Rent-or-buy problem

Computer Architecture

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

Chapter 11 I/O Management and Disk Scheduling

The Quest for Speed - Memory. Cache Memory. A Solution: Memory Hierarchy. Memory Hierarchy

Performance Comparison of RTOS

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

Chapter 11 I/O Management and Disk Scheduling

Linux Process Scheduling Policy

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

Far-western University Central Office, Mahendranagar Operating System

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

OS OBJECTIVE QUESTIONS

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

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

Board Notes on Virtual Memory

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

Midterm Exam #2 November 10, 1999 CS162 Operating Systems

The Classical Architecture. Storage 1 / 36

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

Windows Server Performance Monitoring

Using Synology SSD Technology to Enhance System Performance Synology Inc.

Data Storage - I: Memory Hierarchies & Disks

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

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

Using Synology SSD Technology to Enhance System Performance Synology Inc.

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

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

Operating Systems 4 th Class

COS 318: Operating Systems

Using Synology SSD Technology to Enhance System Performance. Based on DSM 5.2

Page Replacement for Write References in NAND Flash Based Virtual Memory Systems

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

The Real-Time Operating System ucos-ii

COS 318: Operating Systems. Virtual Memory and Address Translation

Chapter 1 Computer System Overview

Introduction. Scheduling. Types of scheduling. The basics

CAs and Turing Machines. The Basis for Universal Computation

All JNTU WORLD. Wipro Previous Year Question Paper. Aptitude Questions :

Technology Update White Paper. High Speed RAID 6. Powered by Custom ASIC Parity Chips

2

Computer Architecture

Lecture 16: Storage Devices

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

PLC-Cache: Endurable SSD Cache for Deduplication-based Primary Storage

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

APP INVENTOR. Test Review

A3 Computer Architecture

Chapter 7 Memory Management

PROBLEMS. which was discussed in Section

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Concept of Cache in web proxies

Computer Organization and Architecture. Characteristics of Memory Systems. Chapter 4 Cache Memory. Location CPU Registers and control unit memory

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

Memory Hierarchy. Arquitectura de Computadoras. Centro de Investigación n y de Estudios Avanzados del IPN. adiaz@cinvestav.mx. MemoryHierarchy- 1

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

Hyper-V vs ESX at the datacenter

IT 342 Operating Systems Fundamentals Fall 2014 Syllabus

In and Out of the PostgreSQL Shared Buffer Cache

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

Data Structures. Topic #12

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

Mass Storage Structure

Performance Monitor for AutoCAD

KVM & Memory Management Updates

This Unit: Caches. CIS 501 Introduction to Computer Architecture. Motivation. Types of Memory

Internet Protocol Address

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

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Physical Data Organization

QLIKVIEW SERVER MEMORY MANAGEMENT AND CPU UTILIZATION

Chapter 4: Computer Codes

COS 318: Operating Systems. Storage Devices. Kai Li Computer Science Department Princeton University. (

White paper. QNAP Turbo NAS with SSD Cache

Operating Systems Concepts: Chapter 7: Scheduling Strategies

OPERATING SYSTEM - MEMORY MANAGEMENT

Node-Based Structures Linked Lists: Implementation

Transcription:

csci 3411: Operating Systems Virtual Memory II Gabriel Parmer Slides adapted from Silberschatz and West

Caching Registers Cache Memory/ RAM

Virtual Memory Registers Cache Memory/ RAM Disk

Page Replacement Use memory as a cache for disk Page replacement Find a victim frame in memory Swap it out transfer it to disk to free that memory for other uses Swapping is the act of moving active memory back and forth from disk Also called paging in page-based systems

Page Replacement III

How do we Choose a Victim Frame? Going to disk is expensive Want to swap as infrequently as possible Find frame that is least likely to be referenced in the near future Optimization: consider frames that already exists on disk, and haven't been modified in RAM! How is this more efficient? Page tables include modified bit (set by hardware when a store is made to the page) Today: Algorithms for finding victim frame Questions so far?

Page Replacement Algorithms Goal: lowest page fault rate Remember 1/1000 memory accesses going to disk 40x slower EAT Evaluate algorithms for a given string of references made by program execution For simplicity, memory references will refer to page numbers of virtual address We need an algorithm to determine the frame to page out to disk Any algorithms come to mind???

FIFO Page Replacement Are the page fault rate and number of frames available correlated? In what way?

Page Faults Versus Number of Frames

FIFO Memory/page reference sequence: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 3 Frames? 4 Frames?

FIFO Memory/page reference sequence: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 1 4 5 1 5 4 2 1 3 9 page faults 2 1 510 page faults 3 2 4 3 2 4 3

Belady's Anomaly

Optimal Page Replacement Replace frame whose next reference is furthest in the future FIFO yields 15 page faults vs. 9 for optimal Lets do better! Ideas?

Caching Based on Historical Behavior Use past behavior to predict future Fundamental assumptions for effective caching Spacial Locality Temporal Locality Why does FIFO perform badly?

Memory Reference Trace

LRU Page Replacement Least Recently Used evict the frame that was accessed furthest into the past Takes advantage of temporal locality Uses past to predict future

LRU Page Replacement II Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 1 1 1 1 5 2 2 2 2 2 3 5 5 4 4 4 4 3 3 3

LRU Implementation I Use system-wide counter Each memory reference increment counter Each page has a time of use field Time of use field updated with counter value on access Which page should we replace?? Which is least recently used? Problems/limitations with this approach?

LRU Implementation II Using a linked list to track references Upon reference, frame placed at top of list Which is the least recently used frame? Problems/limitations with this approach?

LRU Approximation Previous approaches require hardware assistance Memory references in the many millions/second so hardware must manage list/counter Limited hardware support requires approximation Page tables include reference bit Set by hardware when page is referenced (like modified) Basic idea: replace pages that haven't been referenced Loses ordering information

Clock (Second Chance) Algorithm Similar to FIFO, but considers referenced bit for each page If bit == 0, replace page If bit == 1, clear bit and check next page Give page a second chance to stay in memory Worst case: all pages are referenced Cycle through all pages Closest to not frequently used (NFU)

Clock Page Replacement Algorithm

Thrashing I When paging activity overwhelms normal execution Suppose process includes 2 pages: P1, P2 Access to P2 brings it into memory and swaps P1 to disk What happens if P1 is access shortly thereafter?

Thrashing II

Thrashing III Decrease degree of Multiprogramming Should one process that uses many pages cause all processes to slow down due to thrashing? Are there other options?

Global vs. Local Replacement Global replacement Page replacement algorithm considers all frames in the system for replacement i.e. across all processes Local replacement Consider only pages of the process that requires a page to be swapped in Pages allocated separately to different processes Priority based, proportional,... What are the Pros/Cons of each of these?

Locality of Reference 90:10 rule 90% of its time, a program executes 10% of its code 90% of the data accesses are to 10% of the datastructure memory locations Why? Implication: We can achieve a good hit rate (low page fault rate) if we keep that 10% of pages in memory

Memory Reference Trace

Working Set A processes working set is the set of most actively referenced pages at a given point in time Can change Subset of total memory possibly requested by process Thrashing: forall i WSS i > M M = total memory in system WSS i = working set size for process i

Working Set II OS monitors working set of each process Allocate enough frames to fit the working set If there are spare frames New processes can begin If OS cannot accommodate WSS of all processes Suspend process to disk

Monitoring WSS How does the OS monitor the WSS of each process? (Esp. since WSS varies with time!) Allocate frames to process if high page fault freq. Take frames from process if low page fault freq.