Chapter 3 Memory Management (part 2)

Similar documents
MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

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

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

Chapter 4 Memory Management

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD

Chapter 4 Memory Management. Memory Management

Memory: Paging System

CS450/550 Operating Systems

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

Memory management, part 2: outline

Operating Systems Lecture 6: Memory Management II

Memory Management Prof. James L. Frankel Harvard University

Frequently asked questions from the previous class survey

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

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

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

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College

Motivation. Memory Management. Memory Management. Computer Hardware Review

CS510 Operating System Foundations. Jonathan Walpole

Virtual Memory. Today.! Virtual memory! Page replacement algorithms! Modeling page replacement algorithms

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

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

Page replacement algorithms OS

Perform page replacement. (Fig 8.8 [Stal05])

Chapter 3: Important Concepts (3/29/2015)

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo

CS 550 Operating Systems Spring Memory Management: Page Replacement

Memory Management Virtual Memory

Computer Systems II. Memory Management" Subdividing memory to accommodate many processes. A program is loaded in main memory to be executed

Basic Memory Management

Chapter 3 - Memory Management

Course: Operating Systems Instructor: M Umair. M Umair

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

Virtual Memory III. Jo, Heeseung

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012

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

Virtual or Logical. Logical Addr. MMU (Memory Mgt. Unit) Physical. Addr. 1. (50 ns access)

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

Chapter 8 Virtual Memory

Segmentation (Apr 5 and 7, 2005)

Virtual Memory Management

Operating Systems. Operating Systems Sina Meraji U of T

C06: Memory Management

Unit II: Memory Management

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

Memory Management Ch. 3

Paging and Page Replacement Algorithms

10: Virtual Memory Management

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

Virtual Memory Design and Implementation

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

Operating Systems and Computer Networks. Memory Management. Dr.-Ing. Pascal A. Klein

Week 2: Tiina Niklander

Memory Management. Motivation

Practice Exercises 449

Operating Systems, Fall

Virtual Memory Design and Implementation

Memory Management. Memory Management. G53OPS: Operating Systems. Memory Management Monoprogramming 11/27/2008. Graham Kendall.

Persistent Storage - Datastructures and Algorithms

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

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

Chapters 7-8. Memory Management. Chapter 7 - Physical Memory. 7.1 Preparing a Program for Execution

Chapter 9: Virtual-Memory

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

Virtual Memory Design and Implementation

Module 9: Virtual Memory

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Main Points of the Computer Organization and System Software Module

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

VIRTUAL MEMORY. Maninder Kaur. 1

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

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

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

Find the physical addresses of virtual addresses: 0, 8192, 20, 4100, : : : : : 24684

21 Lecture: More VM Announcements From last time: Virtual Memory (Fotheringham, 1961)

Module 9: Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Address spaces and memory management

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle

ΗΥ345 Operating Systems. Recitation 2 Memory Management - Solutions -

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

Caching and Demand-Paged Virtual Memory

Operating Systems (2INC0) 2017/18

Computer Systems II. Memory Management" Subdividing memory to accommodate many processes. A program is loaded in main memory to be executed

Chapter 3 Memory Management: Virtual Memory

Memory Management Virtual Memory

Operating Systems, Fall Lecture 5, Tiina Niklander 1

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

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

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

Operating Systems. IV. Memory Management

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

CSE 153 Design of Operating Systems

MEMORY MANAGEMENT. Term Paper. Operating Systems CS-384

Basic Page Replacement

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

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France

CS 153 Design of Operating Systems Winter 2016

Lecture 14 Page Replacement Policies

Lecture 12: Demand Paging

Transcription:

OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Chapter 3 Memory Management (part 2) MMU Algorithm Let V be a virtual address. Let (i1, i2, ) be the page numbers of V and O be the offset a) If Search for (i1, i2, ) in TLB = SUCCESS a.1) re-order TLB according to LRU a.2) let E be the table entry corresponding to (i1, i2, ) in TLB a.3) if E.present/absent = PRESENT then a.3.1) if E.rights is compatible with memory access a.3.2) then do the memory access at E.frame + O a.3.3) else interrupt with Segmentation Fault a.4) else (E.present/absent = ABSENT) a.4.1) Prepare a Page Replacement to load the page in a frame (c.f. page replacement algorithms) a.4.2) mark the process as waiting for I/O a.4.3) schedule() b) Else (Search in TLB has failed) b.1) Let 2nd level Table = Top Table[i1] (using the same algorithm) b.2) Let 3rd level Table = 2nd level Table[i2] (using the same algorithm) b.3) etc b.4) Let Page = xth level Table[i(x-1)] (using the same algorithm) b.5) goto a) 1

Page Replacement Algorithms Optimal replacement Not recently used (NRU) replacement First-in, first-out (FIFO) replacement Second chance replacement Clock page replacement Least recently used (LRU) replacement Not Recently Used Class 0: not referenced, not modified Class 1: not referenced, modified Class 2: referenced, not moified Class 3: referenced, modified 2

First In First Out The page A is expelled in case of Page Fault. Newest pages are put in front. Second Chance Replacement Figure 4-14. Operation of second chance. (a) Pages sorted in FIFO order. (b) Page list if a page fault occurs at time 20 and A has its R bit set. The numbers above the pages are their loading times. 3

Clock Page Replacement Figure 4-15. The clock page replacement algorithm. 2) Column = 0 Simulating LRU in Software (1) 1) Row = 1 Figure 4-16. LRU using a matrix when pages are referenced in the order 0, 1, 2, 3, 2, 1, 0, 3, 2, 3. 4

Simulating LRU in Software (2) Figure 4-17. The aging algorithm simulates LRU in software. Shown are six pages for five clock ticks. The five clock ticks are represented by (a) to (e). The Working Set Model k Figure 4-18. The working set is the set of pages used by the k most recent memory references. The function w(k, t) is the size of the working set at time t. 5

Local versus Global Allocation Policies Figure 4-19. Local versus global page replacement. (a) Original configuration. (b) Local page replacement. (c) Global page replacement. Page Fault Frequency Figure 4-20. Page fault rate as a function of the number of page frames assigned. 6

Segmentation (1) Examples of tables saved by a compiler 1. The source text being saved for the printed listing (on batch systems). 2. The symbol table, containing the names and attributes of variables. 3. The table containing all the integer and floating-point constants used. 4. The parse tree, containing the syntactic analysis of the program. 5. The stack used for procedure calls within the compiler. These will vary in size dynamically during the compile process Segmentation (2) Figure 4-21. In a one-dimensional address space with growing tables, one table may bump into another. 7

Segmentation (3) Figure 4-22. A segmented memory allows each table to grow or shrink independently of the other tables. Segmentation (4)... Figure 4-23. Comparison of paging and segmentation. 8

Segmentation (4)... Figure 4-23. Comparison of paging and segmentation. Implementation of Pure Segmentation Figure 4-24. (a)-(d) Development of checkerboarding. (e) Removal of the checkerboarding by compaction. 9