CGS 3763 Operating Systems Concepts Spring 2013

Slides:



Advertisements
Similar presentations
SE-292 High Performance Computing
Advertisements

Page Table Implementation
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
Memory Management.
1 Friday, June 30, 2006 "Man's mind, once stretched by a new idea, never regains its original dimensions." - Oliver Wendell Holmes, Jr.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
A. Frank - P. Weisberg Operating Systems Simple/Basic Paging.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Lecture 33: Chapter 5 Today’s topic –Cache Replacement Algorithms –Multi-level Caches –Virtual Memories 1.
Part 8: Virtual Memory. Silberschatz, Galvin and Gagne ©2005 Virtual vs. Physical Address Space Each process has its own virtual address space, which.
Operating Systems Chapter 8
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
IT253: Computer Organization
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
CE Operating Systems Lecture 14 Memory management.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
By Andrew Yee. Virtual Memory Memory Management What is Page Replacement?
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 3:00-4:00 PM.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
Page Table Implementation. Readings r Silbershatz et al:
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Summary of caches: The Principle of Locality: –Program likely to access a relatively small portion of the address space at any instant of time. Temporal.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
COMP 3500 Introduction to Operating Systems Paging: Basic Method Dr. Xiao Qin Auburn University Slides.
Chapter 9: Memory Management
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Virtual Memory Chapter 7.4.
The Memory System (Chapter 5)
Morgan Kaufmann Publishers
Module 9: Virtual Memory
Paging and Segmentation
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Operating System Concepts
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
COT 4600 Operating Systems Fall 2009
ECE 445 – Computer Organization
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
CGS 3763 Operating Systems Concepts Spring 2013
Virtual Memory فصل هشتم.
Lecture 33 Syed Mansoor Sarwar
COT 4600 Operating Systems Spring 2011
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
So far in memory management…
TLB Performance Seung Ki Lee.
Contents Memory types & memory hierarchy Virtual memory (VM)
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Module IV Memory Organization.
Module 9: Virtual Memory
COT 5611 Operating Systems Design Principles Spring 2014
CGS 3763 Operating Systems Concepts Spring 2013
Virtual Memory.
CSE 542: Operating Systems
Presentation transcript:

CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM

Lecture 37 – Monday, April 15, 2013 Last time: Today Next time Answers to student questions Page replacement algorithms Today Implementation of paging Hit and miss ratios Performance penalties Next time Virtual memory Reading assignments Chapters 8 and 9 of the textbook Lecture 37

FIFO Page replacement algorithm PS: Primary storage Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - 4 3 Block 2 in PS 1 Bloch 3 in PS 2 Block 4 in PS Page OUT Page IN 10 Lecture 37

OPTIMAL page replacement algorithm Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - 3 Block 2 in PS 1 Bloch 3 in PS 2 Block 4 in PS 4 Page OUT Page IN 6 Lecture 37

LRU page replacement algorithm Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - Block 2 in PS 1 Bloch 3 in PS 2 4 Block 4 in PS 3 Page OUT Page IN 7 Lecture 37

LRU, OPTIMAL, MRU LRU looks only at history OPTIMAL “knows” not only the history but also the future. In some particular cases Most Recently Used Algorithm performs better than LRU. Example: primary device with 4 cells. Reference string 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 LRU F F F F F F F F F F F F F F F MRU F F F F - - - - F - - - F - - Lecture 37

The OPTIMAL replacement policy keeps in the 3-blocks primary memory the same pages as it does in case of the 4-block primary memory. Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - 3 Block 2 in PS 1 Bloch 3 in PS 2 Block 4 in PS 4 Page OUT Page IN 6 Lecture 37

The FIFO replacement policy does not keep in the 3-blocks primary memory the same pages as it does in case of the 4-block primary memory. Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - 4 3 Block 2 in PS 1 Bloch 3 in PS 2 Block 4 in PS Page OUT Page IN 10 Lecture 37

The LRU replacement policy keeps in the 3-blocks primary memory the same pages as it does in case of the 4-block primary memory. Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - Block 2 in PS 1 Bloch 3 in PS 2 4 Block 4 in PS 3 Page OUT Page IN 7 Lecture 37

The FIFO replacement policy does not keep in the 3-blocks primary memory the same pages as it does in case of the 4-block primary memory Time intervals 1 2 3 4 5 6 7 8 9 10 11 12 Total number of page faults Reference string Block 1 in PS - Block 2 in PS Block 3 in PS Page OUT Page IN Block 1 in PS - 4 3 Block 2 in PS 1 Bloch 3 in PS 2 Block 4 in PS Page OUT Page IN 8 Lecture 37

Implementation of Page Table Page table is kept in main memory Page-table base register (PTBR) points to the page table Page-table length register (PRLR) indicates size of the page table In this scheme every data/instruction access requires two memory accesses. One for the page table and one for the data/instruction. To reduce the access time cache the most recently used frame addresses for pages. Use of a special fast-lookup hardware cache the translation look-aside buffers (TLBs) implemented as an associative memory. Before a process A gets control of the CPU the PTBR register is loaded with the address of the page table of process A the PRLR is loaded with the size of the page table of process A. Lecture 37

Paging hardware Lecture 37

Content addressable or associative memory Allows parallel search. Instead an address you search in parallel for a cell with a given contents. Address translation (p, d) If p is in associative register, get frame # out Otherwise get frame # from page table in memory Page # Frame # Lecture 37

TLB hits and misses Lecture 37

Dynamic address translation Lecture 37

Hit ratio and miss ratios The primary memory is several orders of magnitude faster than the secondary memory. If a virtual address is within a page P previously brought in the primary memory we have a “hit,” otherwise we have a “miss” and before we access the data we have to bring page P from the secondary storage in, a time consuming operation. Hit ratio  the fraction of the total number of memory references when we had a hit. Miss ratio  the fraction of the total number of memory references when we had a miss. Lecture 37

Two-level memory system To understand the effect of the hit/miss ratios we consider only a two level memory system P  a faster and smaller primary memory S  A slower and larger secondary memory. The two levels could be: P  L1 cache and S  main memory P  main memory and S disk Lecture 37

The performance of a two level memory The latency Lp << LS LP  latency of the primary device e.g., 10 nsec for RAM LS  latency of the secondary device, e.g., 10 msec for disk Hit ratio h the probability that a reference will be satisfied by the primary device. Average Latency (AS)  AS = h x LP + (1-h) LS. Example: LP = 10 nsec (primary device is main memory) LS = 10 msec (secondary device is the disk) Hit ratio h= 0.90  AS= 0.9 x 10 + 0.1 x 10,000,000 = 1,000,000.009 nsec~ 1000 microseconds = 1 msec Hit ratio h= 0.99  AS= 0.99 x 10 + 0.01 x 10,000,000 = 100,000.0099 nsec~ 100 microseconds = 0.1 msec Hit ratio h= 0.999  AS= 0.999 x 10 + 0.001 x 10,000,000 = 10,000.0099 nsec~ 10 microseconds = 0.01 msec Hit ratio h= 0.9999  AS= 0.999 0x 10 + 0.001 x 10,000,000 = 1,009.99 nsec~ 1 microsecond This considerable slowdown is due to the very large discrepancy (six orders of magnitude) between the primary and the secondary device. Lecture 37