Caching Principles & Paging Performance CS-502 (EMC) Fall 20091 Caching Principles and Paging Performance CS-502, Operating Systems Fall 2009 (EMC) (Slides.

Slides:



Advertisements
Similar presentations
Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
Advertisements

Paging 1 CS502 Spring 2006 Paging CS-502 Operating Systems.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory OSC: Chapter 9. Demand Paging Copy-on-Write Page Replacement.
Virtual MemoryCS-502 Fall Virtual Memory CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System Concepts, 7 th ed.,
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
Outline, October 2CS-3013 A-term 20091Outline, October 2CS-3013 A-term Outline for October 2 Review:– Caches and Quantification of Cache Performance.
PagingCS-3013 A-term Paging CS-3013, Operating Systems A-term 2009 (Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
1 Lecture 20 – Caching and Virtual Memory  2004 Morgan Kaufmann Publishers Lecture 20 Caches and Virtual Memory.
S.1 Review: The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of.
Computer ArchitectureFall 2008 © CS : Computer Architecture Lecture 22 Virtual Memory (1) November 6, 2008 Nael Abu-Ghazaleh.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
1 Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
ECE 232 L27.Virtual.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 27 Virtual.
CS-3013 & CS-502 Summer 2006 Paging1 CS-3013 & CS-502 Summer 2006.
PagingCS-3013 C-term Paging CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz,
1  2004 Morgan Kaufmann Publishers Chapter Seven.
1 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4 to 6 transistors) DRAM: –value is stored as a charge.
Virtual Memory Topics Virtual Memory Access Page Table, TLB Programming for locality Memory Mountain Revisited.
Virtual Memory Management CS-3013 A-term Virtual Memory Management CS-3013, Operating Systems A-term 2009 (Slides include materials from Modern Operating.
1 CSE SUNY New Paltz Chapter Seven Exploiting Memory Hierarchy.
CMPE 421 Parallel Computer Architecture
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
Virtual Memory CS Introduction to Operating Systems.
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
IT253: Computer Organization
0 High-Performance Computer Architecture Memory Organization Chapter 5 from Quantitative Architecture January 2006.
10/18: Lecture topics Memory Hierarchy –Why it works: Locality –Levels in the hierarchy Cache access –Mapping strategies Cache performance Replacement.
PagingCS-502 Fall Paging CS-502 Operating Systems Fall 2006 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz, Galvin,
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
3-May-2006cse cache © DW Johnson and University of Washington1 Cache Memory CSE 410, Spring 2006 Computer Systems
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
The Goal: illusion of large, fast, cheap memory Fact: Large memories are slow, fast memories are small How do we create a memory that is large, cheap and.
Paging (continued) & Caching CS-3013 A-term Paging (continued) & Caching CS-3013 Operating Systems A-term 2008 (Slides include materials from Modern.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Memory Architecture Chapter 5 in Hennessy & Patterson.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
1 Virtual Memory. Cache memory: provides illusion of very high speed Virtual memory: provides illusion of very large size Main memory: reasonable cost,
PagingCS-502 (EMC) Fall Paging CS-502, Operating Systems Fall 2009 (EMC) (Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew.
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
Memory Hierarchy How to improve memory access. Outline Locality Structure of memory hierarchy Cache Virtual memory.
1  1998 Morgan Kaufmann Publishers Chapter Seven.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
What is it and why do we need it? Chris Ward CS147 10/16/2008.
1 Chapter Seven. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4 to 6 transistors) DRAM: –value.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
CDA 3101 Spring 2016 Introduction to Computer Organization Physical Memory, Virtual Memory and Cache 22, 29 March 2016.
Cache Advanced Higher.
Improving Memory Access The Cache and Virtual Memory
The Goal: illusion of large, fast, cheap memory
CS352H: Computer Systems Architecture
Lecture 12 Virtual Memory.
Ramya Kandasamy CS 147 Section 3
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Lecture 29: Virtual Memory-Address Translation
Caching Principles and Paging Performance
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Practical Session 9, Memory
Caching Principles and Paging Performance
Outline for October 9 Input and Output (continued)
Virtual Memory: Working Sets
Fundamentals of Computing: Computer Architecture
Cache Memory and Performance
CS-3013 Operating Systems A-term 2008
Presentation transcript:

Caching Principles & Paging Performance CS-502 (EMC) Fall Caching Principles and Paging Performance CS-502, Operating Systems Fall 2009 (EMC) (Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum and from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne)

Caching Principles & Paging Performance CS-502 (EMC) Fall Fundamental Observation Paging allows us to treat physical memory as a cache of virtual memory Therefore, all of the principles and issues of caches apply to paging … especially paging performance

Caching Principles & Paging Performance CS-502 (EMC) Fall Definition — Cache A small subset of active items held in small, fast storage while most of the items remain in much larger, slower storage Includes a mechanism for bringing things into cache and throwing them out again!

Caching Principles & Paging Performance CS-502 (EMC) Fall Examples of Caches Paged Virtual Memory –Very large, mostly stored on (slow) disk –Small working set in (fast) RAM during execution Page tables –Very large, mostly stored in (slow) RAM –Small working set stored in (fast) TLB registers

Caching Principles & Paging Performance CS-502 (EMC) Fall Caching is Ubiquitous in Computing Transaction processing Keep records of today’s departures in RAM while records of future flights are on disk Processor performance Keep the bytes near the current program counter in on-chip memory while rest of program is in RAM File management Keep disk maps of open files in RAM while retaining maps of all files on disk Game design Keep nearby environment in cache of each character …

Caching Principles & Paging Performance CS-502 (EMC) Fall Caching issues When to put something in the cache What to throw out to create cache space for new items How to keep cached item and stored item in sync after one or the other is updated How to keep multiple caches in sync across processors or machines Size of cache needed to be effective Size of cache items for efficiency … This is a very important list!

Caching Principles & Paging Performance CS-502 (EMC) Fall General Observation on Caching We create caches because There is not enough fast memory to hold everything we need Memory that is large enough is too slow Performance metric for all caches is EAT Effective Access Time Goal is to make overall performance close to cache memory performance By taking advantage of locality — temporal and spatial By burying a small number of accesses to slow memory under many, many accesses to fast memory

Caching Principles & Paging Performance CS-502 (EMC) Fall Definition – Effective Access Time (EAT) The average access time to memory items, where some items are cached in fast storage and other items are not cached… …weighted by p, the fault rate 0 ≤ p < 1 EAT = (1-p) * (cache access time) + p * (non-cache access time)

Caching Principles & Paging Performance CS-502 (EMC) Fall Goal of Caching To take advantage of locality to achieve nearly the same performance of the fast memory when most data is in slow memory I.e., solve EAT equation for p (1-p)*(cache_time) + p*(non_cache_time) < (1+x)*(cache_time) EAT x is “acceptable” performance penalty

Caching Principles & Paging Performance CS-502 (EMC) Fall Goal of Caching (continued) Select size of cache and size of cache items so that p is low enough to meet acceptable performance goal Usually requires simulation of suite of benchmarks

Caching Principles & Paging Performance CS-502 (EMC) Fall Application to Demand Paging Page Fault Rate (p) 0 < p < 1.0 (measured in average number of faults / reference) Page Fault Overhead = fault service time + read page time + restart process time Fault service time ~ 0.1–10  sec Restart process time ~ 0.1–10–100  sec Read page time ~ 8-20 milliseconds! Dominated by time to read page in from disk!

Caching Principles & Paging Performance CS-502 (EMC) Fall Demand Paging Performance (continued) Effective Access Time (EAT) = (1-p) * (memory access time) + p * (page fault overhead) Want EAT to degrade no more than, say, 10% from true memory access time –i.e., EAT < (1 + 10%) * memory access time

Caching Principles & Paging Performance CS-502 (EMC) Fall Performance Example Memory access time = 100 nanosec = Page fault overhead = 25 millisec = Page fault rate = 1/1000 = EAT = (1-p) * p * (0.025) = (0.999) * *  25 microseconds per reference! I.e.,  250 * memory access time!

Caching Principles & Paging Performance CS-502 (EMC) Fall Performance Goal To achieve less than 10% degradation (1-p) * p * (0.025) < 1.1 * i.e., p < (0.1 * 10 -7) / ( )  I.e., 1 fault in 2,500,000 accesses!

Caching Principles & Paging Performance CS-502 (EMC) Fall Working Set Size Assume average swap time of 25 millisec. For memory access time = 100 nanoseconds Require < 1 page fault per 2,500,000 accesses For memory access time = 1 microsecond Require < 1 page fault per 250,000 accesses For memory access time = 10 microseconds Require < 1 page fault per 25,000 accesses

Caching Principles & Paging Performance CS-502 (EMC) Fall Object Lesson Working sets must get larger in proportion to memory speed! Disk speed ~ constant (nearly) I.e., faster computers need larger physical memories to exploit the speed!

Caching Principles & Paging Performance CS-502 (EMC) Fall Class Discussion 1.What is first thing to do when the PC you bought last year becomes too slow? 2.What else might help? 3.Can we do the same analysis on TLB performance?

Caching Principles & Paging Performance CS-502 (EMC) Fall TLB fault performance Assumptions –m = memory access time = 100 nsec –t = TLB load time from memory = 300 nsec = 3 * m Goal is < 5% penalty for TLB misses –I.e., EAT < 1.05 * m How low does TLB fault rate need to be?

Caching Principles & Paging Performance CS-502 (EMC) Fall TLB fault performance Assumptions –m = memory access time = 100 nsec –t = TLB load time from memory = 300 nsec = 3 * m Goal is < 5% penalty for TLB misses –I.e., EAT < 1.05 * m EAT = (1-p) * m + p * t < 1.05 *m  < (0.05 * m) / (t – m) = 0.05 * m / 2 * m = I.e., TLB fault rate should be < 1 per 40 accesses!

Caching Principles & Paging Performance CS-502 (EMC) Fall TLB fault performance (continued) Q: How large should TLB be so that TLB faults are not onerous, in these circumstances? A: Somewhat less than 40 entries Assuming a reasonable degree of locality! Note: pathological cases may prevent goal altogether!

Caching Principles & Paging Performance CS-502 (EMC) Fall What if Software Loaded TLB? E.g., with hashed or inverted page tables? Assume TLB load time is 100 * m Work out on white board

Caching Principles & Paging Performance CS-502 (EMC) Fall Summary of this Topic A quantitative way of estimating how large the cache needs to be to avoid excessive thrashing, where –Cache = Working set in physical memory –Cache = TLB size in hardware Applicable to all forms of caching

Caching Principles & Paging Performance CS-502 (EMC) Fall General Observation on Caching We create caches because There is not enough fast memory to hold everything we need Memory that is large enough is too slow Performance metric for all caches is EAT Effective Access Time Goal is to make overall performance close to cache memory performance By taking advantage of locality — temporal and spatial By burying a small number of accesses to slow memory under many, many accesses to fast memory

Caching Principles & Paging Performance CS-502 (EMC) Fall Cache Applications Physical memory: cache of virtual memory I.e., RAM over disk TLB: cache of page table entries I.e., Registers over RAM Processor L2 cache: over RAM I.e., nanosecond memory over 10’s of nanoseconds Processor L1 cache: over L2 cache I.e., picosecond registers over nanosecond memory …

Caching Principles & Paging Performance CS-502 (EMC) Fall Cache Applications (continued) Recently accessed blocks of a file I.e., RAM over disk blocks Today’s airline flights I.e., local disk over remote disk

Caching Principles & Paging Performance CS-502 (EMC) Fall Questions?