10/9/2013 Anthony D. Joseph and John Canny CS162 UCB Fall 2013
|
|
- Evan Patterson
- 5 years ago
- Views:
Transcription
1 Post Project 1 lass Format S162 Operating Systems and Systems Programming Lecture 11 Page llocation and Replacement Mini quizzes after each topic Not graded! Simple True/False Immediate feedback for you (and me) Separate from pop quizzes October 9, 2013 nthony. Joseph and John anny Quiz 11.1: aches & TLs Q1: True _ False _ ssociative caches have fewer compulsory misses than direct mapped caches Q2: True _ False _ Two-way set associative caches can cache two addresses with same cache index Q3: True _ False _ With write-through caches, a read miss can result in a write Q5: True _ False _ TL caches translations to virtual addresses Quiz 11.1: aches & TLs Q1: True _ False _ X ssociative caches have fewer compulsory misses than direct mapped caches Q2: True X_ False _ Two-way set associative caches can cache two addresses with same cache index Q3: True _ False _ X With write-through caches, a read miss can result in a write Q5: True _ False X_ TL caches translations to virtual addresses Page 1
2 ddress: Review: Two-level table 10 bits 10 bits 12 bits P1 index P2 index Offset Physical ddress: Physical Page # Offset X86_64: Four-level table! 9 bits 9 bits 9 bits 9 bits 12 bits 48-bit Offset ddress: P1 index P2 index P3 index P4 index 4K PageTablePtr PageTablePtr 4 bytes 8 bytes 4096-byte s (12 bit offset) Page tables also 4k bytes (able) 4 bytes Physical ddress: (40-50 bits) Physical Page # 12bit Offset I64: 64bit addresses: Six-level table?!? I64: Inverse Page Table (IPT) Idea: index the table by physical s instead of VM 64bit 7 bits 9 bits 9 bits 9 bits 9 bits 9 bits 12 bits ddress: P1 index P2 index P3 index P4 index P5 index P6 index Offset No! Too slow Too many almost-empty tables VM0 VM1 VM2 VM3 Process id 0 memory VM0 0x0 pid 1 0x1 VM2 0x2 VM1 0x3 xx free 0x4 pid 2 0x5 pid 1 0x6 VM3 0x7 Inverse Page Table 0x0000 0x1000 0x2000 0x3000 0x4000 0x5000 0x6000 0x7000 VM0, proc0 VM2, proc0 VM1, proc0 VM3, proc0 Physical memory in 4k s Page numbers in red Page 2
3 IPT address translation Need an associative map from VM to IPT address: Use a hash map. Process 0 virtual address VM2 (52b) Offset (12b) Physical address 0x3 Offset (12b) IPT address translation Note: can t share memory: only one hashed entry will match. Process 0 address VM2 (52b) Offset (12b) Hash VM # pid 1 xx pid 2 pid 1 VM0 VM1 VM2 free VM3 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x0000 0x1000 0x2000 0x3000 0x4000 0x5000 0x6000 VM0, proc0 VM2, proc0 VM1, proc0 Process 1 address VM4 (52b) Offset (12b) pid 1 xx pid 2 pid 1 VM0 VM1 VM2 free VM3 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Inverse Page Table 0x7000 VM3, proc0 Inverse Page Table I64: Inverse Page Table (IPT) Pros: Page table size naturally linked to physical memory size. Only two memory accesses (most of the time). Shouldn t need to out the table. Hash function can be very fast if implemented in hardware. ons: an t (easily) share s. Have to manage collisions, e.g. by chaining, which adds memory accesses. Quiz 11.2: ddress Translation Q1: True _ False _ Paging does not suffer from external fragmentation Q2: True _ False _ The segment offset can be larger than the segment size Q3: True _ False _ Paging: to compute the physical address, add physical # and offset Q4: True _ False _ Uni-programming doesn t provide address protection Q5: True _ False _ address space is always larger than physical address space Q6: True _ False _ Inverted tables keeps fewer entries than multi-level tables Page 3
4 Quiz 11.2: ddress Translation Q1: True _ X False _ Paging does not suffer from external fragmentation Q2: True _ False _ X The segment offset can be larger than the segment size Q3: True _ False _ X Paging: to compute the physical address, add physical # and offset Q4: True _ X False _ Uni-programming doesn t provide address protection Q5: True _ False _ X address space is always larger than physical address space Q6: True _ False _ X Inverted tables keeps fewer entries than multi-level tables PageTablePtr Review: Translation Lookaside uffer ddress: P1 index P2 index Offset Page Table (1 st level) TL: Page Table (2 nd level) Physical ddress: Physical Page # Offset Physical Memory: ddress: P1 index P2 index PageTablePtr Offset Review: ache Physical ddress: Physical Page # Offset Physical Memory: Goals for Today Page Replacement Policies FIFO LRU lock lgorithm Page Table (1 st level) Page Table (2 nd level) tag index byte cache: tag: block: TL: Note: Some slides and/or pictures in the following are adapted from slides 2005 Silberschatz, Galvin, and Gagne. Many slides generated from my lecture notes by Kubiatowicz Page 4
5 emand Paging Modern programs require a lot of physical memory Memory per system growing faster than 25%-30%/year ut they don t use all their memory all of the time rule: programs spend 90% of their time in 10% of their code Wasteful to require all of user s code to be in memory Solution: use main memory as cache for disk/ss Processor ore ore aching Main Memory (RM) aching Secondary Storage (SS) Secondary Storage (isk) emand Paging is aching Since emand Paging is aching, we must ask: Question What is the block size? What is the organization of this cache (i.e., direct-mapped, setassociative, fully-associative)? How do we find a in the cache? What is replacement policy? (i.e., LRU, Random, ) What happens on a miss? What happens on a write? (i.e., write-through, write-back) hoice 1 Fully-associative: arbitrary virtual physical mapping First check TL, then traverse tables Requires more explanation (kinda LRU) Go to lower level to fill a miss (i.e., disk) efinitely write-back. Need a dirty bit ()! emand Paging Mechanisms PTE helps us implement demand paging Valid Page in memory, PTE points at physical Not Valid Page not in memory; use info in PTE to find it on disk when necessary Suppose user references with invalid PTE? Memory Management Unit (MMU) traps to OS» Resulting trap is a Page Fault What does OS do on a Page Fault?:» hoose an old to replace» If old modified ( =1 ), write contents back to disk» hange its PTE and any cached TL to be invalid» Load new into memory from disk» Update table entry, invalidate TL for new entry» ontinue thread from original faulting location TL for new will be loaded when thread continued! While pulling s off disk for one process, OS runs another process from ready queue» Suspended process sits on wait queue Steps in Handling a Page Fault Page 5
6 emand Paging Example Since emand Paging like caching, can compute average access time! ( Effective ccess Time ) ET = Hit Rate x Hit Time + Miss Rate x Miss Time Example: Memory access time = 200 nanoseconds verage -fault service time = 8 milliseconds Suppose p = Probability of miss, 1-p = Probably of hit Then, we can compute ET as follows: ET = (1 p) x 200ns + p x 8 ms = (1 p) x 200ns + p x 8,000,000ns = 200ns + p x 7,999,800ns If one access out of 1,000 causes a fault, then ET = 8.2 μs: This is a slowdown by a factor of 40! What if want slowdown by less than 10%? ET < 200ns x 1.1 p < 2.5 x 10-6 This is about 1 fault in 400,000! What Factors Lead to Misses? ompulsory Misses: Pages that have never been d into memory before How might we remove these misses?» Prefetching: loading them into memory before needed» Need to predict future somehow! More later. apacity Misses: Not enough memory. Must somehow increase size. an we do this?» One option: Increase amount of RM (not quick fix!)» nother option: If multiple processes in memory: adjust percentage of memory allocated to each one! onflict Misses: Technically, conflict misses don t exist in virtual memory, since it is a fully-associative cache Policy Misses: aused when s were in memory, but kicked out prematurely because of the replacement policy How to fix? etter replacement policy Page Replacement Policies Why do we care about Replacement Policy? Replacement is an issue with any cache Particularly important with s» The cost of being wrong is high: must go to disk» Must keep important s in memory, not toss them out FIFO (First In, First Out) Throw out oldest. e fair let every live in memory for same amount of time. ad, because throws out heavily used s instead of infrequently used s MIN (Minimum): Replace that won t be used for the longest time Great, but can t really know future Makes good comparison case, however RNOM: Pick random for every replacement Typical solution for TL s. Simple hardware Unpredictable Replacement Policies (on t) FIFO: Replace that has been in for the longest time. e fair to s and give them equal time. ad idea because use is not even. We want to give more time to heavily used s. How to implement FIFO? It s a queue (can use a linked list) Head(Oldest) Page 6 Page 7 Page 1 Page 2 Oldest is at head Tail(Newest) When a is brought in, add it to tail. Eject head if list longer than capacity Page 6
7 Replacement Policies (on t) LRU (Least Recently Used): Replace that hasn t been used for the longest time Programs have locality, so if something not used for a while, unlikely to be used in the near future. Seems like LRU should be a good approximation to MIN. How to implement LRU? Use a list? Replacement Policies (on t) LRU (Least Recently Used): Replace that hasn t been used for the longest time Programs have locality, so if something not used for a while, unlikely to be used in the near future. Seems like LRU should be a good approximation to MIN. ifferent if we access a that is already loaded: Head(LRU) Page 6 Page 7 Page 1 Page 2 Head(LRU) Page 6 Page 2 Page 1 Page 2 LRU is at head Tail (MRU) When a is used for the first time, add it to tail. Eject head if list longer than capacity LRU is at head Tail (MRU) When a is used again, remove from list, add it to tail. Eject head if list longer than capacity Replacement Policies (on t) LRU (Least Recently Used): Replace that hasn t been used for the longest time Programs have locality, so if something not used for a while, unlikely to be used in the near future. Seems like LRU should be a good approximation to MIN. ifferent if we access a that is already loaded: Head(LRU) Page 6 Page 1 Page 2 LRU is at head Tail (MRU) When a is used again, remove from list, add it to tail. Eject head if list longer than capacity Problems with this scheme for paging? Updates are happening on use, not just swapping List structure requires extra pointers c.f. FIFO, more updates In practice, people approximate LRU (more later) Suppose we have 3 frames, 4 virtual s, and following reference stream: onsider FIFO Page replacement: Ref: Page: Example: FIFO FIFO: 7 faults. When referencing, replacing is bad choice, since need again right away Page 7
8 Example: MIN Suppose we have the same reference stream: onsider MIN Page replacement: Ref: Page: MIN: 5 faults Look for not referenced farthest in future. What will LRU do? Same decisions as MIN here, but won t always be true! When will LRU perform badly? onsider the following: LRU Performs as follows (same as FIFO here): Ref: Page: Every reference is a fault! MIN oes much better: Ref: Page: Graph of Page Faults Versus The Number of Frames dding Memory oesn t lways Help Fault Rate oes adding memory reduce number of faults? Yes for LRU and MIN Not necessarily for FIFO! (alled elady s anomaly) Page: E E E Page: E E One desirable property: When you add memory the miss rate goes down oes this always happen? Seems like it should, right? No: elady s anomaly ertain replacement algorithms (FIFO) don t have this obvious property! E 2 E 3 4 fter adding memory: With FIFO, contents can be completely different In contrast, with LRU or MIN, contents of memory with X s are a subset of contents with X+1 Page Page 8
9 dministrivia Project #1: esign doc (submit proj1 final design) and group evals (Google ocs form) due today at 11:59PM» Group evals are anonymous to your group Midterm #1 is Monday Oct 21 5:30-7pm in 145 winelle (-L) and 2060 Valley LS (M-Z) losed book, double-sided handwritten of notes, no calculators, smartphones, Google glass etc. overs lectures #1-13 (isks/sss, Filesystems), readings, handouts, and projects 1 and 2 Review session 390 Hearst Mining, Fri October 18, 5-7 PM 5min reak lass feedback is always welcome! Implementing LRU & Second hance Second hance Illustration Perfect: Timestamp on each reference Keep list of s ordered by time of reference Too expensive to implement in reality for many reasons Second hance lgorithm: pproximate LRU» Replace an old, not the oldest FIFO with use bit etails use bit per physical» set when accessed On fault check at head of queue» If use bit=1 clear bit, and move to tail (give the second chance!)» If use bit=0 replace Moving s to tail still complex Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives first loaded last loaded u: Page 9
10 Second hance Illustration Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives Second hance Illustration Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives first loaded last loaded first loaded last loaded u:1 u:1 F Second hance Illustration Second hance Illustration Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives ccess Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives ccess Page E arrives first loaded last loaded first loaded last loaded u:1 u:1 F u:1 u:1 F Page 10
11 Second hance Illustration Second hance Illustration Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives ccess Page E arrives Max table size 4 Page arrives Page arrives ccess Page arrives Page arrives ccess Page E arrives first loaded last loaded first loaded last loaded u:1 F F E lock lgorithm lock Replacement Illustration lock lgorithm: more efficient implementation of second chance algorithm rrange physical s in circle with single clock hand etails: On fault:» heck use bit: 1 used recently; clear and leave it alone 0 selected candidate for replacement» dvance clock hand (not real time) Will always find a or loop forever? Max table size 4 Invariant: point at oldest Page arrives Page 11
12 lock Replacement Illustration Max table size 4 Invariant: point at oldest lock Replacement Illustration Max table size 4 Invariant: point at oldest Page arrives Page arrives ccess Page arrives Page arrives ccess Page arrives u: lock Replacement Illustration lock Replacement Illustration Max table size 4 Max table size 4 Invariant: point at oldest Invariant: point at oldest Page arrives Page arrives ccess Page arrives Page arrives u:1 Page arrives Page arrives ccess Page arrives Page arrives ccess F u: Page 12
13 lock Replacement Illustration lock lgorithm: iscussion Max table size 4 Invariant: point at oldest What if hand moving slowly? Good sign or bad sign?» Not many faults and/or find quickly Page arrives Page arrives ccess Page arrives Page arrives ccess Page E arrives E F u:1 u:1 What if hand is moving quickly? Lots of faults and/or lots of reference bits set N th hance version of lock lgorithm N th chance algorithm: Give N chances OS keeps counter per : # sweeps On fault, OS checks use bit:»1 clear use and also clear counter (used in last sweep)»0 increment counter; if count=n, replace Means that clock hand has to sweep by N times without being used before is replaced How do we pick N? Why pick large N? etter approx to LRU» If N ~ 1K, really good approximation Why pick small N? More efficient» Otherwise might have to look a long way to find free What about dirty s? Takes extra overhead to replace a dirty, so give dirty s an extra chance before replacing? ommon approach:» lean s, use N=1» irty s, use N=2 (and write back to disk when N=1) Quiz 11.3: emand Paging Q1: True _ False _ emand paging incurs conflict misses Q2: True _ False _ LRU can never achieve higher hit rate than MIN Q3: True _ False _ The LRU miss rate may increase as the cache size increases Q4: True _ False _ The lock algorithm is a simpler implementation of the Second hance algorithm Q5: ssume a cache with 100 s. The number of s that the Second hance algorithm may need to check before finding a to evict is at most Page 13
14 Quiz 11.3: emand Paging Q1: True _ False _ X emand paging incurs conflict misses Q2: True _ X False _ LRU can never achieve higher hit rate than MIN Q3: True _ False _ X The LRU miss rate may increase as the cache size increases Q4: True _ X False _ The lock algorithm is a simpler implementation of the Second hance algorithm Q5: ssume a cache with 100 s. The number of s that the Second hance algorithm may need to check before finding a to evict is at most Summary (1/2) emand Paging: Treat memory as cache on disk ache miss find free, get from disk Transparent Level of Indirection User program is unaware of activities of OS behind scenes ata can be moved without affecting application correctness Replacement policies FIFO: Place s on queue, replace at head» Fair but can eject in-use s, suffers from elady s anomaly MIN: Replace that will be used farthest in future» enchmark for comparisons, can t implement in practice LRU: Replace used farthest in past» For efficiency, use approximation Summary (2/2) lock lgorithm: pproximation to LRU rrange all s in circular list Sweep through them, marking as not in use If not in use for one pass, than can replace Page 14
3/3/2014! Anthony D. Joseph!!CS162! UCB Spring 2014!
Post Project 1 Class Format" CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" Mini quizzes after each topic Not graded Simple True/False Immediate feedback for
More informationCS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement"
CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" October 3, 2012 Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Lecture 9 Followup: Inverted Page Table" With
More informationPage 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"
Goals for Today" CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" Finish discussion on TLBs! Page Replacement Policies! FIFO, LRU! Clock Algorithm!! Working Set/Thrashing!
More informationCS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement
S6 Operating Systems and Systems Programming Lecture 5 Page llocation and Replacement October, 006 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs6 Review: emand Paging Mechanisms PT helps us
More informationCS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement
S6 Operating Systems and Systems Programming Lecture 5 Page llocation and Replacement October, 007 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs6 Review: emand Paging Mechanisms PT helps us
More informationVIRTUAL MEMORY READING: CHAPTER 9
VIRTUAL MEMORY READING: CHAPTER 9 9 MEMORY HIERARCHY Core! Processor! Core! Caching! Main! Memory! (DRAM)!! Caching!! Secondary Storage (SSD)!!!! Secondary Storage (Disk)! L cache exclusive to a single
More informationCMPT 300 Introduction to Operating Systems. Page Replacement Algorithms
MPT 300 Introduction to Operating Systems Page Replacement lgorithms 0 Demand Paging Modern programs require a lot of physical memory Memory per system growing faster than 25%-30%/year ut they don t use
More informationOperating Systems (1DT020 & 1TT802) Lecture 9 Memory Management : Demand paging & page replacement. Léon Mugwaneza
Operating Systems (1DT020 & 1TT802) Lecture 9 Memory Management : Demand paging & page replacement May 05, 2008 Léon Mugwaneza http://www.it.uu.se/edu/course/homepage/os/vt08 Review: Multiprogramming (with
More informationCS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement
S6 Operating Systems and Systems Programming Lecture 5 Page llocation and Replacement October, 009 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs6 Review: emand Paging Mechanisms PT helps us
More informationCMPT 300 Introduction to Operating Systems
MPT 300 Introduction to Operating Systems Page Replacement lgorithms 1 Demand Paging Modern programs require a lot of physical memory ut they donʼt use all their memory all of the time 90-10 rule: 90%
More informationCS162 Operating Systems and Systems Programming Lecture 14. Caching and Demand Paging
CS162 Operating Systems and Systems Programming Lecture 14 Caching and Demand Paging October 17, 2007 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs162 Review: Hierarchy of a Modern Computer
More informationPage 1. CS162 Operating Systems and Systems Programming Lecture 14. Caching and Demand Paging
CS162 Operating Systems and Systems Programming Lecture 14 Caching and Demand Paging March 4, 2010 Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Review: Hierarchy of a Modern Computer System Take advantage
More information10/7/13! Anthony D. Joseph and John Canny CS162 UCB Fall 2013! " (0xE0)" " " " (0x70)" " (0x50)"
Goals for Todayʼs Lecture" CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs" October 7, 2013! Anthony D. Joseph and John Canny! http//inst.eecs.berkeley.edu/~cs162! Paging- and
More informationCS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 15: Caching: Demand Paged Virtual Memory
CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2003 Lecture 15: Caching: Demand Paged Virtual Memory 15.0 Main Points: Concept of paging to disk Replacement policies
More informationPage 1. Review: Address Segmentation " Review: Address Segmentation " Review: Address Segmentation "
Review Address Segmentation " CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs" February 23, 2011! Ion Stoica! http//inst.eecs.berkeley.edu/~cs162! 1111 0000" 1110 000" Seg #"
More informationECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I)
ECE7995 Caching and Prefetching Techniques in Computer Systems Lecture 8: Buffer Cache in Main Memory (I) 1 Review: The Memory Hierarchy Take advantage of the principle of locality to present the user
More informationVirtual Memory Design and Implementation
Virtual Memory Design and Implementation Today! Page replacement algorithms! Some design and implementation issues Next! Last on virtualization VMMs How can any of this work?!?!! Locality Temporal locality
More informationLast class: Today: Paging. Virtual Memory
Last class: Paging Today: Virtual Memory Virtual Memory What if programs require more memory than available physical memory? Use overlays ifficult to program though! Virtual Memory. Supports programs that
More informationLecture#16: VM, thrashing, Replacement, Cache state
Lecture#16: VM, thrashing, Replacement, Cache state Review -- 1 min Multi-level translation tree: multi-level page table, paged paging, paged segmentation, hash table: inverted page table combination:
More informationCSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management
CSE 120 July 18, 2006 Day 5 Memory Instructor: Neil Rhodes Translation Lookaside Buffer (TLB) Implemented in Hardware Cache to map virtual page numbers to page frame Associative memory: HW looks up in
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L20 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Questions from last time Page
More informationLecture 12: Demand Paging
Lecture 1: Demand Paging CSE 10: Principles of Operating Systems Alex C. Snoeren HW 3 Due 11/9 Complete Address Translation We started this topic with the high-level problem of translating virtual addresses
More informationMemory Management. Disclaimer: some slides are adopted from book authors slides with permission 1
Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory Disk
More informationOperating Systems. Operating Systems Sina Meraji U of T
Operating Systems Operating Systems Sina Meraji U of T Recap Last time we looked at memory management techniques Fixed partitioning Dynamic partitioning Paging Example Address Translation Suppose addresses
More information! What is virtual memory and when is it useful? ! What is demand paging? ! What pages should be. ! What is the working set model?
Virtual Memory Questions? CSCI [4 6] 730 Operating Systems Virtual Memory! What is virtual memory and when is it useful?! What is demand paging?! What pages should be» resident in memory, and» which should
More informationCS162 Operating Systems and Systems Programming Lecture 14. Caching and Demand Paging
CS162 Operating Systems and Systems Programming Lecture 14 Caching and Demand Paging October 20, 2008 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs162 Review: Hierarchy of a Modern Computer
More informationVirtual Memory Design and Implementation
Virtual Memory Design and Implementation q q q Page replacement algorithms Design and implementation issues Next: Last on virtualization VMMs Loading pages When should the OS load pages? On demand or ahead
More informationPast: Making physical memory pretty
Past: Making physical memory pretty Physical memory: no protection limited size almost forces contiguous allocation sharing visible to program easy to share data gcc gcc emacs Virtual memory each program
More informationLast Class: Demand Paged Virtual Memory
Last Class: Demand Paged Virtual Memory Benefits of demand paging: Virtual address space can be larger than physical address space. Processes can run without being fully loaded into memory. Processes start
More informationMemory Management. Disclaimer: some slides are adopted from book authors slides with permission 1
Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 Recap Paged MMU: Two main Issues Translation speed can be slow TLB Table size is big Multi-level page table
More informationPAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo
PAGE REPLACEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics What if the physical memory becomes full? Page replacement algorithms How to manage memory among competing processes? Advanced
More informationReadings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.
Readings and References Virtual Memory Reading Chapter through.., Operating System Concepts, Silberschatz, Galvin, and Gagne CSE - Computer Systems December, Other References Chapter, Inside Microsoft
More informationCS162 Operating Systems and Systems Programming Lecture 14. Caching (Finished), Demand Paging
CS162 Operating Systems and Systems Programming Lecture 14 Caching (Finished), Demand Paging October 11 th, 2017 Neeraja J. Yadwadkar http://cs162.eecs.berkeley.edu Recall: Caching Concept Cache: a repository
More informationMemory Management. Disclaimer: some slides are adopted from book authors slides with permission 1
Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 Demand paging Concepts to Learn 2 Abstraction Virtual Memory (VM) 4GB linear address space for each process
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 33 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How does the virtual
More informationVirtual Memory - II. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XVI. University at Buffalo.
CSE 421/521 - Operating Systems Fall 2012 Lecture - XVI Virtual Memory - II Tevfik Koşar University at Buffalo October 25 th, 2012 1 Roadmap Virtual Memory Page Replacement Algorithms Optimal Algorithm
More informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 18 Lecture 18/19: Page Replacement Memory Management Memory management systems Physical and virtual addressing; address translation Techniques: Partitioning,
More informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 18: Page Replacement Terminology in Paging A virtual page corresponds to physical page/frame Segment should not be used anywhere Page out = Page eviction
More informationVirtual Memory. Chapter 8
Virtual Memory 1 Chapter 8 Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time E.g., process may be swapped in and out of main memory
More informationOperating Systems Virtual Memory. Lecture 11 Michael O Boyle
Operating Systems Virtual Memory Lecture 11 Michael O Boyle 1 Paged virtual memory Allows a larger logical address space than physical memory All pages of address space do not need to be in memory the
More informationCS162 Operating Systems and Systems Programming Lecture 16. Page Allocation and Replacement (con t) I/O Systems
CS162 Operating Systems and Systems Programming Lecture 16 Page Allocation and Replacement (con t) I/O Systems October 24, 2007 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs162 Review: Page
More informationVirtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging
TDDB68 Concurrent programming and operating systems Overview: Virtual Memory Virtual Memory [SGG7/8] Chapter 9 Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality
More informationVirtual Memory III. Jo, Heeseung
Virtual Memory III Jo, Heeseung Today's Topics What if the physical memory becomes full? Page replacement algorithms How to manage memory among competing processes? Advanced virtual memory techniques Shared
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Fall 2016 Lecture 11: Page Replacement Geoffrey M. Voelker Administrivia Lab time This week: Thu 4pm, Sat 2pm Next week: Tue, Wed At Washington University in St.
More informationADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems ( ) Chapter 6: Demand Paging
ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems (5-006-00) Chapter 6: Demand Paging http://redmine.replicant.us/projects/replicant/wiki/samsunggalaxybackdoor (0) # Inverted page table One
More informationPaging! 2/22! Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2012! " (0xE0)" " " " (0x70)" " (0x50)"
CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs" February 22, 2011! Anthony D. Joseph and Ion Stoica! http//inst.eecs.berkeley.edu/~cs162! Segmentation! Paging! Recap Segmentation
More informationCS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs"
CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs" October 1, 2012! Prashanth Mohan!! Slides from Anthony Joseph and Ion Stoica! http://inst.eecs.berkeley.edu/~cs162! Caching!
More information!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?
Chapter 10: Virtual Memory Questions? CSCI [4 6] 730 Operating Systems Virtual Memory!! What is virtual memory and when is it useful?!! What is demand paging?!! When should pages in memory be replaced?!!
More informationVirtual or Logical. Logical Addr. MMU (Memory Mgt. Unit) Physical. Addr. 1. (50 ns access)
Virtual Memory - programmer views memory as large address space without concerns about the amount of physical memory or memory management. (What do the terms 3-bit (or 6-bit) operating system or overlays
More informationPage Replacement. (and other virtual memory policies) Kevin Webb Swarthmore College March 27, 2018
Page Replacement (and other virtual memory policies) Kevin Webb Swarthmore College March 27, 2018 Today s Goals Making virtual memory virtual : incorporating disk backing. Explore page replacement policies
More informationVirtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory
TDIU Operating systems Overview: Virtual Memory Virtual Memory Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality [SGG7/8/9] Chapter 9 Copyright Notice: The
More informationChapter 6: Demand Paging
ADRIAN PERRIG & TORSTEN HOEFLER ( 5-006-00 ) Networks and Operating Systems Chapter 6: Demand Paging Source: http://redmine.replicant.us/projects/replicant/wiki/samsunggalaxybackdoor If you miss a key
More informationOperating System Concepts
Chapter 9: Virtual-Memory Management 9.1 Silberschatz, Galvin and Gagne 2005 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped
More informationVirtual Memory: Policies. CS439: Principles of Computer Systems March 5, 2018
Virtual Memory: Policies CS439: Principles of Computer Systems March 5, 28 Last Time Overlays Paging Pages Page frames Address translation Today s Agenda Paging: Mechanisms Page Tales Page Faults Paging:
More informationChapter 8 Virtual Memory
Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Modified by Rana Forsati for CSE 410 Outline Principle of locality Paging - Effect of page
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 32 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Questions for you What is
More informationVirtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory
Virtual Memory Virtual Memory CSCI Operating Systems Design Department of Computer Science Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in
More informationLecture #15: Translation, protection, sharing
Lecture #15: Translation, protection, sharing Review -- 1 min Goals of virtual memory: protection relocation sharing illusion of infinite memory minimal overhead o space o time Last time: we ended with
More informationReminder: Mechanics of address translation. Paged virtual memory. Reminder: Page Table Entries (PTEs) Demand paging. Page faults
CSE 451: Operating Systems Autumn 2012 Module 12 Virtual Memory, Page Faults, Demand Paging, and Page Replacement Reminder: Mechanics of address translation virtual address virtual # offset table frame
More informationChapter 9: Virtual Memory
Chapter 9: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating
More informationAddress spaces and memory management
Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address
More informationPaging algorithms. CS 241 February 10, Copyright : University of Illinois CS 241 Staff 1
Paging algorithms CS 241 February 10, 2012 Copyright : University of Illinois CS 241 Staff 1 Announcements MP2 due Tuesday Fabulous Prizes Wednesday! 2 Paging On heavily-loaded systems, memory can fill
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 23 Virtual memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Is a page replaces when
More informationVirtual Memory. CSCI 315 Operating Systems Design Department of Computer Science
Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture were based on those Operating Systems Concepts, 9th ed., by Silberschatz, Galvin, and
More informationMemory: Paging System
Memory: Paging System Instructor: Hengming Zou, Ph.D. In Pursuit of Absolute Simplicity 求于至简, 归于永恒 Content Paging Page table Multi-level translation Page replacement 2 Paging Allocate physical memory in
More informationChapter 9: Virtual-Memory
Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Other Considerations Silberschatz, Galvin and Gagne 2013
More informationAll Paging Schemes Depend on Locality. VM Page Replacement. Paging. Demand Paging
3/14/2001 1 All Paging Schemes Depend on Locality VM Page Replacement Emin Gun Sirer Processes tend to reference pages in localized patterns Temporal locality» locations referenced recently likely to be
More informationCS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement. Page 1
CS162 Operating Systems and Systems Programming Lecture 15 Page Allocation and Replacement March 19, 2008 Prof. Anthony D. Josep http://inst.eecs.berkeley.edu/~cs162 Review: Demand Paging Mechanisms PTE
More informationToday. Adding Memory Does adding memory always reduce the number of page faults? FIFO: Adding Memory with LRU. Last Class: Demand Paged Virtual Memory
Last Class: Demand Paged Virtual Memory Benefits of demand paging: Virtual address space can be larger than physical address space. Processes can run without being fully loaded into memory. Processes start
More informationHow to create a process? What does process look like?
How to create a process? On Unix systems, executable read by loader Compile time runtime Ken Birman ld loader Cache Compiler: generates one object file per source file Linker: combines all object files
More informationCS 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 Page replacement Assume a normal page table (e.g., BLITZ) User-program is
More informationCS 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 Page replacement Assume a normal page table (e.g., BLITZ) User-program is
More informationBasic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1
Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming
More informationChapter 8 Virtual Memory
Chapter 8 Virtual Memory Contents Hardware and control structures Operating system software Unix and Solaris memory management Linux memory management Windows 2000 memory management Characteristics of
More informationPage Replacement Algorithms
Page Replacement Algorithms MIN, OPT (optimal) RANDOM evict random page FIFO (first-in, first-out) give every page equal residency LRU (least-recently used) MRU (most-recently used) 1 9.1 Silberschatz,
More informationChapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition
Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating
More informationMove back and forth between memory and disk. Memory Hierarchy. Two Classes. Don t
Memory Management Ch. 3 Memory Hierarchy Cache RAM Disk Compromise between speed and cost. Hardware manages the cache. OS has to manage disk. Memory Manager Memory Hierarchy Cache CPU Main Swap Area Memory
More informationMemory Management Ch. 3
Memory Management Ch. 3 Ë ¾¾ Ì Ï ÒÒØ Å ÔÔ ÓÐÐ 1 Memory Hierarchy Cache RAM Disk Compromise between speed and cost. Hardware manages the cache. OS has to manage disk. Memory Manager Ë ¾¾ Ì Ï ÒÒØ Å ÔÔ ÓÐÐ
More informationCS162 Operating Systems and Systems Programming Lecture 12. Address Translation. Page 1
CS162 Operating Systems and Systems Programming Lecture 12 Translation March 10, 2008 Prof. Anthony D. Joseph http://inst.eecs.berkeley.edu/~cs162 Review: Important Aspects of Memory Multiplexing Controlled
More informationOperating Systems Lecture 6: Memory Management II
CSCI-GA.2250-001 Operating Systems Lecture 6: Memory Management II Hubertus Franke frankeh@cims.nyu.edu What is the problem? Not enough memory Have enough memory is not possible with current technology
More informationVirtual Memory COMPSCI 386
Virtual Memory COMPSCI 386 Motivation An instruction to be executed must be in physical memory, but there may not be enough space for all ready processes. Typically the entire program is not needed. Exception
More informationEECS 482 Introduction to Operating Systems
EECS 482 Introduction to Operating Systems Fall 2017 Manos Kapritsos Slides by: Harsha V. Madhyastha Recap: Paging Both address spaces and physical memory broken up into fixed size pages Address Space
More informationOperating Systems (2INC0) 2017/18
Operating Systems (2INC0) 2017/18 Virtual Memory (10) Dr Courtesy of Dr I Radovanovic, Dr R Mak System rchitecture and Networking Group genda Recap memory management in early systems Principles of virtual
More informationCS162 Operating Systems and Systems Programming Lecture 16. Page Allocation and Replacement (con t) I/O Systems
CS162 Operating Systems and Systems Programming Lecture 16 Page Allocation and Replacement (con t) I/O Systems October 27, 2010 Prof. John Kubiatowicz http://inst.eecs.berkeley.edu/~cs162 Review: Page
More informationVirtual Memory Management
Virtual Memory Management CS-3013 Operating Systems Hugh C. Lauer (Slides include materials from Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum and from Operating
More informationChapter 9: Virtual Memory. Operating System Concepts 9 th Edition
Chapter 9: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating
More informationBasic Memory Management
Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it
More informationVirtual Memory. 1 Administrivia. Tom Kelliher, CS 240. May. 1, Announcements. Homework, toolboxes due Friday. Assignment.
Virtual Memory Tom Kelliher, CS 240 May. 1, 2002 1 Administrivia Announcements Homework, toolboxes due Friday. Assignment From Last Time Introduction to caches. Outline 1. Virtual memory. 2. System support:
More informationMemory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.
Memory Management To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time. Basic CPUs and Physical Memory CPU cache Physical memory
More informationEvicMng the best page #2: FIFO. #1: Belady s Algorithm. CS 537 Lecture 11 Page Replacement Policies 11/1/11. Michael SwiF
EvicMng the best page CS 537 Lecture 11 Page Replacement Policies Michael The goal of the page replacement algorithm: reduce fault rate by selecmng best vicmm page to remove the best page to evict is one
More informationChapter 4: Memory Management. Part 1: Mechanisms for Managing Memory
Chapter 4: Memory Management Part 1: Mechanisms for Managing Memory Memory management Basic memory management Swapping Virtual memory Page replacement algorithms Modeling page replacement algorithms Design
More informationMEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019
MEMORY: SWAPPING Shivaram Venkataraman CS 537, Spring 2019 ADMINISTRIVIA - Project 2b is out. Due Feb 27 th, 11:59 - Project 1b grades are out Lessons from p2a? 1. Start early! 2. Sketch out a design?
More informationChapter 8: Virtual Memory. Operating System Concepts
Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating
More informationECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management
ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Memory Management 1 Hardware background The role of primary memory Program
More informationOperating System Principles: Memory Management Swapping, Paging, and Virtual Memory CS 111. Operating Systems Peter Reiher
Operating System Principles: Memory Management Swapping, Paging, and Virtual Memory Operating Systems Peter Reiher Page 1 Outline Swapping Paging Virtual memory Page 2 Swapping What if we don t have enough
More informationSwapping. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Swapping Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Swapping Support processes when not enough physical memory User program should be independent
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 21 Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Why not increase page size
More informationChapter 8 Virtual Memory
Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Operating Systems: Internals and Design Principles You re gonna need a bigger boat. Steven
More information21 Lecture: More VM Announcements From last time: Virtual Memory (Fotheringham, 1961)
21 Lecture: More VM Outline: Announcements From last time: Virtual Memory (Fotheringham, 1961) What it s all about Translation Logistics(HERE) Where to keep the page table? Possible approaches to dealing
More informationSwapping. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University
Swapping Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE0: Introduction to Operating Systems, Fall 07, Jinkyu Jeong (jinkyu@skku.edu) Swapping
More information