The Working Set. CS 355 Operating Systems. The Working Set. Working Set Model 3/27/18. Paging Algorithms and Segmentation

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

Chapter 4 Memory Management. Memory Management

Chapter 3 Memory Management (part 2)

Memory Management Virtual Memory

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems

The Operating System. Chapter 6

CS450/550 Operating Systems

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

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

Chapter 4 Memory Management

Basic Memory Management

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Motivation. Memory Management. Memory Management. Computer Hardware Review

Page Size Page Size Design Issues

Virtual to physical address translation

Operating Systems, Fall Lecture 5 1. Overhead due to page table and internal fragmentation. Tbl 8.2 [Stal05] 4.

Clock page algorithm. Least recently used (LRU) NFU algorithm. Aging (NFU + forgetting) Working set. Process behavior

Process size is independent of the main memory present in the system.

Operating Systems, Fall Lecture 5 1

Operating Systems, Fall Lecture 5, Tiina Niklander 1

Chapter 8 Virtual Memory

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

Memory Management Virtual Memory

Chapter 8 Virtual Memory

Move back and forth between memory and disk. Memory Hierarchy. Two Classes. Don t

Memory Management Ch. 3

Memory management, part 2: outline

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

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

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

Operating Systems: Internals and Design Principles. Chapter 7 Memory Management Seventh Edition William Stallings

Module 8: Memory Management

Memory management, part 3: outline

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory

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

Main Memory CHAPTER. Exercises. 7.9 Explain the difference between internal and external fragmentation. Answer:

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

Virtual Memory Management

MEMORY MANAGEMENT/1 CS 409, FALL 2013

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

Memory management, part 3: outline

Chapter 8: Main Memory

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system

Operating Systems CSE 410, Spring Virtual Memory. Stephen Wagner Michigan State University

Chapter 8: Memory-Management Strategies

Chapter 8: Main Memory

SHANDONG UNIVERSITY 1

Chapter 8: Memory- Manage g me m nt n S tra r t a e t gie i s

Chapter 8: Memory Management

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

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

Lecture 12: Demand Paging

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

Logical versus Physical Address Space

Operating Systems Lecture 6: Memory Management II

CS399 New Beginnings. Jonathan Walpole

Chapters 9 & 10: Memory Management and Virtual Memory

Paging algorithms. CS 241 February 10, Copyright : University of Illinois CS 241 Staff 1

Chapter 8: Main Memory

Operating Systems. Operating Systems Sina Meraji U of T

Operating Systems. User OS. Kernel & Device Drivers. Interface Programs. Memory Management

Page replacement algorithms OS

a process may be swapped in and out of main memory such that it occupies different regions

Design Issues 1 / 36. Local versus Global Allocation. Choosing

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CSCI 4717 Computer Architecture. Memory Management. What is Swapping? Swapping. Partitioning. Fixed-Sized Partitions (continued)

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018


Module 9: Virtual Memory

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables

Preview. Review. Modeling Page Replacement Algorithm. Modeling Page Replacement Algorithm. Modeling Page Replacement Algorithm (Stack Algorithm)

Chapter 8: Main Memory

Memory Management and Protection

Chapter 3 - Memory Management

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

VIRTUAL MEMORY. Operating Systems 2015 Spring by Euiseong Seo

Course: Operating Systems Instructor: M Umair. M Umair

Q1. What is Deadlock? Explain essential conditions for deadlock to occur?

Module 9: Virtual Memory

Virtual Memory. Today. Segmentation Paging A good, if common example

Chapter 8: Memory Management Strategies

CSE 380 Computer Operating Systems

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

Operating System 1 (ECS-501)

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Virtual Memory Design and Implementation

CS307: Operating Systems

Virtual Memory III. Jo, Heeseung

Module 8: Memory Management

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Page Table Structure. Hierarchical Paging. Hashed Page Tables. Inverted Page Tables

CS 153 Design of Operating Systems Winter 2016

CSE 153 Design of Operating Systems

Module 9: Memory Management. Background. Binding of Instructions and Data to Memory

Goals of Memory Management

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Transcription:

CS 355 Operating Systems Paging Algorithms and 1 Processes exhibit locality of memory reference During any phase of execution, the process references only a relatively small fraction of its pages. The set of pages a process is currently using is called its working set Demand paging A process starts up with no pages in memory and a bunch of page faults until the working set is in memory If memory is too small to hold the entire working set, it will lead to trashing What happens during a context switch? 2 Working Set Model Designed to greatly reduce the page fault rate Pages are loaded before letting a process run this is also known as pre-paging At any instance of time t, there exists a set w(k, t) consisting of all pages used by the k most recent memory references. The working set changes over time References tend to cluster on a small number of pages: data, instruction and stack 3 4 Keeping track of all pages used in the last k memory references is expensive Instead, record pages used in the last time interval, say 100 msec. Virtual time (kept per process) The working set is the set of pages referenced during the past t seconds of virtual time Algorithm: replace the page not in working set Page table: clock tick clears R bit periodically On page fault, scan all R bits. If 1, the current virtual time is written into tolu (time of last use) field. If 0, compute age of page with virtual-tolu. If age is smaller than time interval t? 5 6 1

3/27/18 7 Review of Page Replacement Algorithms Modeling Page Replacement Algorithms The more page frames there are, the fewer pages faults a program will get? 9 10 Belady's Anomaly Paging FIFO with 3 page frames FIFO with 4 page frames P's show which page references show page faults 11 Suffers from internal fragmentation NO user view Page size fixed In paging, user specifies only a single address Single address is partitioned by HW into page no. and offset 12 2

One Dimensional Address Space So far virtual addresses go from 0 to max Consider programs with many growing memory chunks The solution is to have more than one virtual addressing spaces, so that each may grow and shrink at will, called segments Each segment consist of linear addresses going from 0 to some max An address in segmented memory has two parts segment number and address within the segment One-dimensional address space with growing tables One table may bump into another 13 14 Allows each table to grow or shrink, independently 15 Advantage of Allows data structures to grow independently Simplifies the linking process for compilation Each procedure/function in separate segment All separately compiled procedures start at segment address 0, respectively A procedure call to a procedure in segment n will be linked as a two part address (n, 0) If the same procedure is subsequently modified and recompiled, no other procedures need be changed, as their starting addresses have not be modified Shared libraries are shared by putting it in a segment shared by multiple processes 16 vs Paging Implementation of Pure (a)-(d) Development of checkerboarding (e) Removal of the checkerboarding by compaction 17 18 3

with Paging: MULTICS MULTICS Virtual Address A 34-bit MULTICS virtual address Descriptor segment points to page tables Segment descriptor numbers are field lengths 19 20 MULTICS Address Translation MULTICS TLB Conversion of a 2-part MULTICS address into a main memory address 21 22 with Paging: Pentium Pentium Segment Descriptors A Pentium selector Pentium code segment descriptor Data segments differ slightly 23 24 4

Pentium: Linear Address Pentium: 2-level Paging Conversion of a (selector, offset) pair to a linear address Mapping of a linear address onto a physical address 25 26 and Paging Paging is transparent to the programmer Paging eliminates external fragmentation Pieces are to be moved in and out paging helps! is visible to the programmer allows for growing data structures, modularity, and support for sharing and protection Each segment is broken into fixed-size pages and Paging Combine paging & segmentation -- best of both worlds What about overheads in terms of HW support? Is it worth it? 27 28 Pentium: Protection Level Protection As long as a program restricts itself to using segments at its own level, everything works fine. Attempts to access data at a higher level are permitted, at a lower level are illegal and causes traps. Attempts to call procedures at a different level (higher or lower) are allowed but controlled. To make an inter-level call, the CALL instruction must contain a selector instead of an address. This selector designates a descriptor called a callgate, which gives the address of the procedure to be called. 29 30 5