Operating Systems (2INC0) 2017/18
|
|
- Phoebe Potter
- 6 years ago
- Views:
Transcription
1 Operating Systems (2INC0) 2017/18 Virtual Memory (10) Dr Courtesy of Dr I Radovanovic, Dr R Mak System rchitecture and Networking Group
2 genda Recap memory management in early systems Principles of virtual memory Paging Segmentation Paging and Segmentation 2
3 genda Recap memory management in early systems Principles of virtual memory Paging Segmentation Paging and Segmentation 3
4 Memory management: requirements IDELLY, memory needs to be Simple to use Private (isolation) Non-volatile / permanent (data remains in memory) Fast (zero-time) access Huge (unlimited) capacity Cheap (cost-effective) These are conflicting We may make use of memory hierarchy and virtualization to compensate 4
5 Memory Hierarchy CPU Registers Larger storage Secondary Primary (Executable) L1 Cache Memory L2 Cache Memory \ Main Memory Solid State Memory Rotating Magnetic Memory Optical Memory Faster access Sequentially ccessed Memory 5
6 Early systems (properties) Every active process resides in its entirety in MM Large programs can t execute (except with an overlay structure) Overlay: Structure a program in independent parts (eg function calls) which can be overlayed in memory C versus D E Every active process is allocated a contiguous part of main memory Three partitioning schemes fixed, dynamic, relocatable dynamic partitions 6
7 Early systems (partitioning schemes) Fixed partitions limits the number and maximal size of the active processes internal fragmentation Dynamic partitions external fragmentation Relocatable dynamic partitions requires dynamic binding and relocatable load modules no fragmentation, but expensive compaction (or swapping) 7
8 Recap: Do we have the ideal memory properties so far? Simple Private Permanent Fast Huge Yes Yes/No No No No With the exception of overlays Isolation can be provided with dynamic binding No sharing Unless the programmer enforces this during execution Process-based compaction and swapping are expensive Process size cannot exceed main memory size Cost-effective Yes Hardware hierarchy 8
9 genda Recap memory management in early systems Principles of virtual memory Paging Segmentation Paging and Segmentation 9
10 VM: abstraction What needs to be done such that programs do not have to be stored contiguously, and not the entire program, but only parts are stored in main memory? pproach: Split the memory into segments and try to fit parts of the program into those segments Terminology: If segments are of different sizes: segmentation If segments are of the same size: paging Physical memory blocks: (page) frames Logical memory blocks: pages Paging and segmentation can be combined 10
11 Paging memory allocation Processes divided into pages (memory blocks) of equal size provides non-contiguous memory allocation works well if page size is equal to page frame size and the disk s section size (sectors) (size: 350 lines) dvantages: n empty page frame is always usable by any process The compaction scheme is not required No external and almost no internal fragmentation Disadvantage: Mechanism needed to keep track of page locations 11
12 Non-contiguous allocation -an example- P1 size=350 lines page size = 100 lines OS size = 300 lines Internal fragmentation Process 1 Main Memory Page frame # 1 st 100 lines Operating system 0 1 Page nd 100 lines 4 Page 1 Process 1 Page rd 100 lines Process 1 Page 0 8 Page 2 9 Process 1 Page 1 10 Remaining 50 lines Page 3 Process 1 Page 3 11 Wasted space 12 The number of free page frames left (13-3-4) = 6 ny process of more than 600 lines has to wait until Proc1 ends ny process of more than 1000 lines cannot fit into memory at all! Problem remains (needs solving): Entire process must be stored in memory during its execution 12
13 VM: Demand paging ring a page into memory only when it is needed Takes advantage of the fact that programs are written sequentially (not all pages are necessary at once) For example: User-written error handling modules Mutually exclusive modules Some parts are not always accessible Only a fraction of table is actually used No restriction of having the entire process stored in memory Gives appearance of an infinite physical memory 13
14 VM: implementation issues ddress binding / translation logical addresses translated to physical ones at run time HW support to reduce access time & to enforce isolation Placement strategies simple for pages: any free page frame will do for segments, strategies are similar to those for dynamic partitions Replacement strategies that decide which page(s) or segment(s) must be swapped out in case there is not enough free space in MM Load control policies that determine how many pages of a process are resident in MM? when to load pages into MM (demand paging, pre-paging)? Sharing possible with both paging and segmentation 14
15 genda Recap memory management in early systems Principles of virtual memory Paging address translation frame table, page table, TLs replacement strategies load policies Segmentation Segmentation with paging 15
16 Frame table vs Page table Page Frame Index Process ID Process page number Process Page Index Page Frame Number Say the CPU wants to load an instruction of a certain process (at a certain page p and an offset w) How to find physical address (pa)? 16
17 Virtual vs physical address va p bits w bits Page number p w w: offset in the corresponding page (# words) Virtual ddress (for a process id) 2 p pages 2 w words/page VM size: 2 p + w words pa Goal: address a word f bits w bits Frame number f w Physical ddress 2 f page frames 2 w words/page (or /frame) PM size: 2 f + w words 17
18 How to find physical address using the frame table? Virtual address: Recall example Page Frame Index pid p F-1 id p w f id p pid page w frame f page p address_map (id, p, w) { pa = UNDEFINED; } for (f = 0; f<f; f++) { } if (FT[f]pid == id && FT[f]page == p ) pa = f w return pa; Concatenate bits f and w 18
19 How to find physical address using page tables? Virtual address: id p w address_map (p, w) { pa = *(PTR+p) w; } return pa; PTR frame f Recall example Proc Page Index Page Frame Number p f w page p Page Table Register (PTR) is used for fast access (hardware support) Its content is stored in the process table Reading/writing from/to memory requires two memory accesses: One for accessing the page table, and one for accessing actual data 19
20 Process table maintained by OS for context switching and scheduling, etc Entries (rows) are process control info: name, state, priority, registers, a semaphore waited on, page table location etc Process Table (a) Process Table (b) Process Table (c) P1 P2 P3 Process Size Page Table Location Process Size Page Table Location Process Size Page Table Location (a) PT has 3 entries initially; one for each process (b) second process ends, entry in table is released and replaced by (c) information about next process that is processed 20
21 Translation Look-aside uffer Problems with page tables They can be huge It requires 2 memory accesses per reference pproach use a TL (a cache memory) keeps track of locations of the most recently used pages in MM does not contain actual data or instructions most common replacement scheme: least recently used (LRU) if the page location cannot be found in the TL, the page table is used if the page location still cannot be found a page fault is generated meaning the page is currently not found in the physical memory 21
22 Page faults Page faults happen when a part of program needs to be brought into MM Upon page fault: Page fault handler determines whether there are empty frames in MM If not, it must decide which page to swap out This depends on predefined policy for page removal single memory reference may create several page faults eg when the page table itself is not in MM Tables to be updated after swapping: Page tables of two tasks (1 in 1 out) and table to locate free frames Problem with swapping: Thrashing 22
23 Thrashing process may spend more time paging than executing When does it happen? Pages in active use are replaced by other pages in active use Happens with increased degree of multiprogramming Solution: Provide the process with as many frames in MM as it needs needs a replacement strategy 23
24 Thrashing -an example- Swapping between these two pages for (j=1; j<100; ++j) { } k:=j*j; m:=a*j; printf( \n%d %d %d, j, k, m); printf( \n ); Page 0 Page 1 24
25 genda Recap memory management in early systems Principles of virtual memory Paging address translation frame table, page table, TLs replacement strategies load policies Segmentation Segmentation with paging 25
26 Replacement strategies Comparison of replacement strategies is done using reference strings an execution trace in which only memory references are recorded only the page number of the referenced location is mentioned Reference string: r 0 r 1 r 2 Goodness criteria the number of generated page faults the total number of pages loaded due to page faults (these two are equal under pure demand paging) Global strategies fixed number of page frames shared by all processes evicted page need not be owned by the process that needs extra memory Local strategies each process has a set of pages called the working set when a process runs out of memory a page from its working set is evicted 26
27 Global replacement strategies MIN replacement (looks to the future) select the page which will not be used for the longest time in the future, this gives the minimum number of page faults Random replacement select a random page for replacement FIFO replacement select the page that has been resident in MM for the longest time LRU replacement select the page that is least recently used Clock replacement (second chance) circular list of all resident pages equipped with a use-bit u upon each reference u is set to 1 (set to 2 for third chance) search clockwise for u=0, while setting the use-bits to zero 27
28 MIN policy (looks to the future) Page requested: C D C D Page Frame 1 Page D D D D D Page Frame 2 (empty) C C C C Interrupt : Time: * 1 * 2 3 * 4 5 * 6 * 7 8 * 9 * How each page requested is swapped into the 2 available page frames using MIN When program is ready to be processed all 4 pages are on secondary storage Throughout program: 11 page requests are issued When program calls a page that isn t already in memory, a page fault is issued (shown by *) à 7 page faults 28
29 FIFO policy Page Requested: C D C D Page Frame 1 Page C C D Page Frame 2 (empty) D D D C C Interrupt: Time: * 1 * 2 3 * 4 * 5 * 6 * 7 8 * 9 * 10 * 11 à 9 page faults 29
30 LRU policy Page Requested: C D C D Page Frame 1 Page D D D Page Frame 2 (empty) C C C C Interrupt: Time: * 1 * 2 3 * 4 5 * 6 * 7 8 * 9 * 10 * 11 Only 8 page faults Efficiency slightly better than FIFO The most widely used static replacement algorithm 30
31 Page Table Extensions Extra fields Page Status bit Referenced bit Modified bit Page frame Status bit indicates whether page is currently in memory or not Referenced bit (use bit) indicates whether page has been referenced recently Used by LRU to determine which pages should be swapped out Modified bit (dirty bit) indicates whether page contents have been altered Used to determine if page must be rewritten to secondary storage when it is swapped out There may be more of these bits for other purposes, eg, locking 31
32 Local Replacement strategies VMIN replacement looks to the future at each memory reference if there is page fault, then the requested page is loaded immediately if that page is not referenced during the next τ memory references, it is removed Working Set (WS) Model uses recent history (past τ memory references) at each memory reference a WS is determined only the pages that belong to the WS reside in MM a process can run if its entire WS is in MM the working set is given by W (t, τ) = { r j t-τ < j t } Reference string: r 0 r 1 r 2 r T hardware support in the form of aging registers 32
33 Working-set model (example) set of active pages large enough to avoid trashing Use a parameter τ to determine a working-set window Page reference window τ = 9 τ = 9 WS (t 1 )={1,2,5,6,7} WS (t 2 )={3,4} D = WSSi D: the total demand for frames in memory WSS i : the working set size for process i Thrashing will occur when D is greater than the total number of available frames! 33
34 Working set an example Time t e d Reference string a c c d b c e c e a d Page a Page b Page c -- Page d Page e IN t c * b * e * a * d * OUT t e a d b Working set: from t-τ to t; ie (t-τ, t]; in this case τ=4 34
35 genda Recap memory management in early systems Principles of virtual memory Paging address translation frame table, page table, TLs replacement strategies load policies Segmentation Segmentation with paging 35
36 Load control Paging strategy which and how many pages to load static paging: upon activation all pages of the process are loaded also called simple paging dynamic paging: upon a page fault one or more pages are loaded pure demand paging loads a single page demand paging with pre-paging loads several pages upon (re)activation Degree of multiprogramming when using local replacement (working set) à automatic when using global replacement à a separate policy is needed to determine the number of pages per process service time of a page fault vs average time between page faults a good tradeoff will help avoid thrashing 36
37 Load control (cnt d) Global replacement with static paging: Replace the pages of which process? (depends on scheduling) lowest priority process follows CPU scheduling (unlikely to be immediately scheduled again) last process activated considered to be the least important smallest process least expensive to swap out largest process frees the largest number of frames 37
38 genda Recap memory management in early systems Principles of virtual memory Paging Segmentation Segmentation with paging 38
39 Segmented memory allocation ased on common practice by programmers of structuring their programs in modules (logical groupings of code) segment is a logical unit such as: main program, subroutine, procedure, function, local variables, global variables, common block, stack, symbol table, or an array Main memory is not divided into page frames because size of each segment is different Memory is allocated dynamically 39
40 Segmentation Each process has three obvious candidates code, data, and stack other candidates are stacks of the individual threads of a process memory-mapped files Virtual addresses consist of segment number s and offset w address_map (s, w) { pa = *(STR+s)+w; return pa; } Note: *(STR+s) gives the address of the first word of the segment s Until now: Pure segmentation: contiguous segments Next: Segmentation with paging: paged segments 40
41 genda Recap memory management in early systems Principles of virtual memory Paging Segmentation Segmentation with paging address translation, segment table, TLs 41
42 Segment + page tables Virtual address: s p w STR frame f Segment Table Register s p f w page p 42
43 Segment + page tables (cnt d) Each memory reference requires three accesses to MM address_map (s, p, w) { pa = *(*(STR+s)+p)+w; } return pa; Use TL to reduce memory accesses per reference to one alance between s and p older systems: s long and p short many small segments: segment tables are large and can themselves be paged this results in yet another memory access multimedia applications, however, favor s short and p long many pages of a segment: now the page tables are large and must be paged 43
44 dvantages of VM Works well in a multiprogramming environment most programs spend a lot of time waiting Process size is no longer restricted to MM size (or the free space within main memory) Memory is used more efficiently Eliminates external fragmentation when used with paging and eliminates internal fragmentation when used with segmentation llows an unlimited amount of multiprogramming llows a program to be loaded multiple times occupying a different memory location each time llows sharing of code and data Facilitates dynamic linking of program segments 44
45 Disadvantages of VM Increased processor hardware costs Increased overhead for handling paging interrupts Increased software complexity to prevent thrashing 45
46 Last remark: Cache memory CPU CPU bus Cache Memory bus memory device memory device is based on the principle of locality a high-speed memory that speeds up the CPU s access to data increases performance no need to contend for the bus 46
47 Cache memory -improved efficiency- Cache hit ratio h: h = number of requests foundin the cache total number of requests verage main memory access time: t t t a c m = h t c + (1 h) t average cache access time m average main memory access time 47
48 Summary Simple Yes User has a linear address space Private Yes VM also facilitates sharing Permanent Fast No Moderate Unless the programmer enforces this during execution Management overhead for tables and strategies Huge Yes Memory size virtually unlimited Cost-effective Yes Hardware support for VM can be expensive 48
49 History: Memoryc Taken from 49
Chapters 7-8. Memory Management. Chapter 7 - Physical Memory. 7.1 Preparing a Program for Execution
Chapters 7-8 Memory Management Real memory Logical storage Address spaces Virtual memory 1 Chapter 7 - Physical Memory 71 Preparing a Program for Execution Program Transformations Logical-to-Physical Address
More informationOperating Systems (2INC0) 2017/18
Operating Systems (2INC0) 2017/18 Memory Management (09) Dr. Courtesy of Dr. I. Radovanovic, Dr. R. Mak (figures from Bic & Shaw) System Architecture and Networking Group Agenda Reminder: OS & resources
More informationChapter 8. Virtual Memory
Operating System Chapter 8. Virtual Memory Lynn Choi School of Electrical Engineering Motivated by Memory Hierarchy Principles of Locality Speed vs. size vs. cost tradeoff Locality principle Spatial Locality:
More informationa process may be swapped in and out of main memory such that it occupies different regions
Virtual Memory Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory Memory references are dynamically
More informationCS450/550 Operating Systems
CS450/550 Operating Systems Lecture 4 memory Palden Lama Department of Computer Science CS450/550 Memory.1 Review: Summary of Chapter 3 Deadlocks and its modeling Deadlock detection Deadlock recovery Deadlock
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 informationMemory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization
Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical
More informationChapter 3 Memory Management: Virtual Memory
Memory Management Where we re going Chapter 3 Memory Management: Virtual Memory Understanding Operating Systems, Fourth Edition Disadvantages of early schemes: Required storing entire program in memory
More informationMemory Management. Dr. Yingwu Zhu
Memory Management Dr. Yingwu Zhu Big picture Main memory is a resource A process/thread is being executing, the instructions & data must be in memory Assumption: Main memory is infinite Allocation of memory
More informationMemory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.
Chapter 4 Memory Management Ideally programmers want memory that is Memory Management large fast non volatile 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms
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 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 have been largely based on those from an earlier edition of the course text Operating
More informationMemory Management Virtual Memory
Memory Management Virtual Memory Part of A3 course (by Theo Schouten) Biniam Gebremichael http://www.cs.ru.nl/~biniam/ Office: A6004 April 4 2005 Content Virtual memory Definition Advantage and challenges
More informationMEMORY MANAGEMENT/1 CS 409, FALL 2013
MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization
More informationMemory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time
Memory Management To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed
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 informationCSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018
CSE 4/521 Introduction to Operating Systems Lecture 27 (Final Exam Review) Summer 2018 Overview Objective: Revise topics and questions for the final-exam. 1. Main Memory 2. Virtual Memory 3. Mass Storage
More informationWeek 2: Tiina Niklander
Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Policies and methods Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka
More informationCS 5523 Operating Systems: Memory Management (SGG-8)
CS 5523 Operating Systems: Memory Management (SGG-8) Instructor: Dr Tongping Liu Thank Dr Dakai Zhu, Dr Palden Lama, and Dr Tim Richards (UMASS) for providing their slides Outline Simple memory management:
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 informationOperating Systems, Fall
Policies and methods Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka
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 informationOptimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs
Optimal Algorithm Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs page 1 Least Recently Used (LRU) Algorithm Reference string: 1, 2, 3,
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 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 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 informationMemory Management Prof. James L. Frankel Harvard University
Memory Management Prof. James L. Frankel Harvard University Version of 5:42 PM 25-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Memory Management Ideal memory Large Fast Non-volatile
More informationVirtual Memory Outline
Virtual Memory Outline Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations Operating-System Examples
More information12: Memory Management
12: Memory Management Mark Handley Address Binding Program goes through multiple steps from compilation to execution. At some stage, addresses in the program must be bound to physical memory addresses:
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 informationLecture 9: Virtual Memory
Lecture 9: Virtual Memory Summary 1. omputer system overview (hapter 1) 2. asic of virtual memory; i.e. segmentation and paging (hapter 7 and part of 8) 3. Process (hapter 3) 4. Mutual xclusion and Synchronization
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 informationChapter 4 Memory Management
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7
More informationPerform page replacement. (Fig 8.8 [Stal05])
Virtual memory Operations and policies Chapters 3.4. 3.7 1 Policies and methods Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka ) Where to place the new
More informationBackground. Virtual Memory (2/2) Demand Paging Example. First-In-First-Out (FIFO) Algorithm. Page Replacement Algorithms. Performance of Demand Paging
Virtual Memory (/) Background Page Replacement Allocation of Frames Thrashing Background Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in memory
More informationOperating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015
Operating Systems 09. Memory Management Part 1 Paul Krzyzanowski Rutgers University Spring 2015 March 9, 2015 2014-2015 Paul Krzyzanowski 1 CPU Access to Memory The CPU reads instructions and reads/write
More informationChapter 5B. Large and Fast: Exploiting Memory Hierarchy
Chapter 5B Large and Fast: Exploiting Memory Hierarchy One Transistor Dynamic RAM 1-T DRAM Cell word access transistor V REF TiN top electrode (V REF ) Ta 2 O 5 dielectric bit Storage capacitor (FET gate,
More informationModule 9: Virtual Memory
Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmenation 9.1 Background
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 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 informationPreview. Memory Management
Preview Memory Management With Mono-Process With Multi-Processes Multi-process with Fixed Partitions Modeling Multiprogramming Swapping Memory Management with Bitmaps Memory Management with Free-List Virtual
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. 3/9/07 CSE 30341: Operating Systems Principles
Page Replacement page 1 Page Replacement Algorithms Want lowest page-fault rate Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number
More informationChapters 9 & 10: Memory Management and Virtual Memory
Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection
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 informationFirst-In-First-Out (FIFO) Algorithm
First-In-First-Out (FIFO) Algorithm Reference string: 7,0,1,2,0,3,0,4,2,3,0,3,0,3,2,1,2,0,1,7,0,1 3 frames (3 pages can be in memory at a time per process) 15 page faults Can vary by reference string:
More informationAddresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.
1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and
More informationChapter 4 Memory Management. Memory Management
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7
More informationChapter 9 Memory Management
Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual
More informationModule 9: Virtual Memory
Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmentation Operating
More informationComputer Systems II. Memory Management" Subdividing memory to accommodate many processes. A program is loaded in main memory to be executed
Computer Systems II Memory Management" Memory Management" Subdividing memory to accommodate many processes A program is loaded in main memory to be executed Memory needs to be allocated efficiently to
More informationMemory Management. Jo, Heeseung
Memory Management Jo, Heeseung Today's Topics Why is memory management difficult? Old memory management techniques: Fixed partitions Variable partitions Swapping Introduction to virtual memory 2 Memory
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 informationChapter 9: Virtual Memory
Chapter 9: Virtual Memory Chapter 9: Virtual Memory 9.1 Background 9.2 Demand Paging 9.3 Copy-on-Write 9.4 Page Replacement 9.5 Allocation of Frames 9.6 Thrashing 9.7 Memory-Mapped Files 9.8 Allocating
More informationProcess size is independent of the main memory present in the system.
Hardware control structure Two characteristics are key to paging and segmentation: 1. All memory references are logical addresses within a process which are dynamically converted into physical at run time.
More informationCS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018
CS 31: Intro to Systems Virtual Memory Kevin Webb Swarthmore College November 15, 2018 Reading Quiz Memory Abstraction goal: make every process think it has the same memory layout. MUCH simpler for compiler
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 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 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 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 informationChapter 9: Virtual Memory
Chapter 9: Virtual Memory Multiprogramming Memory Management so far 1. Dynamic Loading The main Program gets loaded into memory Routines are stored in Relocatable Load format on disk As main program (or
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 informationstack Two-dimensional logical addresses Fixed Allocation Binary Page Table
Question # 1 of 10 ( Start time: 07:24:13 AM ) Total Marks: 1 LRU page replacement algorithm can be implemented by counter stack linked list all of the given options Question # 2 of 10 ( Start time: 07:25:28
More informationVirtual Memory. Reading: Silberschatz chapter 10 Reading: Stallings. chapter 8 EEL 358
Virtual Memory Reading: Silberschatz chapter 10 Reading: Stallings chapter 8 1 Outline Introduction Advantages Thrashing Principal of Locality VM based on Paging/Segmentation Combined Paging and Segmentation
More informationOperating Systems Design Exam 2 Review: Spring 2011
Operating Systems Design Exam 2 Review: Spring 2011 Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 CPU utilization tends to be lower when: a. There are more processes in memory. b. There are fewer processes
More information10: Virtual Memory Management
CSC400 - Operating Systems 10: Virtual Memory Management J. Sumey Introduction virtual memory management: concerned with the actual management operations of a virtual memory system fetch strategies: when
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 informationCS6401- Operating System UNIT-III STORAGE MANAGEMENT
UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into
More informationMemory management, part 2: outline
Memory management, part 2: outline Page replacement algorithms Modeling PR algorithms o Working-set model and algorithms Virtual memory implementation issues 1 Page Replacement Algorithms Page fault forces
More informationCS 416: Opera-ng Systems Design March 23, 2012
Question 1 Operating Systems Design Exam 2 Review: Spring 2011 Paul Krzyzanowski pxk@cs.rutgers.edu CPU utilization tends to be lower when: a. There are more processes in memory. b. There are fewer processes
More informationMemory Management Virtual Memory
Background; key issues Memory Management Virtual Memory Memory allocation schemes Virtual memory Memory management design and implementation issues 1 Remember Basic OS structures: intro in historical order
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 informationFall COMP3511 Review
Outline Fall 2015 - COMP3511 Review Monitor Deadlock and Banker Algorithm Paging and Segmentation Page Replacement Algorithms and Working-set Model File Allocation Disk Scheduling Review.2 Monitors Condition
More information1. Background. 2. Demand Paging
COSC4740-01 Operating Systems Design, Fall 2001, Byunggu Yu Chapter 10 Virtual Memory 1. Background PROBLEM: The entire process must be loaded into the memory to execute limits the size of a process (it
More informationMEMORY MANAGEMENT. Jo, Heeseung
MEMORY MANAGEMENT Jo, Heeseung TODAY'S TOPICS Why is memory management difficult? Old memory management techniques: Fixed partitions Variable partitions Swapping Introduction to virtual memory 2 MEMORY
More informationMemory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels
Memory management, part 2: outline 1 Page Replacement Algorithms Page fault forces choice o which page must be removed to make room for incoming page? Modified page must first be saved o unmodified just
More informationOperating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1
Operating systems Module 11 Main memory introduction Part 1 Tami Sorgente 1 MODULE 11 MAIN MEMORY INTRODUCTION Background Swapping Contiguous Memory Allocation Noncontiguous Memory Allocation o Segmentation
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 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 informationOperating Systems. Memory Management. Lecture 9 Michael O Boyle
Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation Goals
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 informationThe Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation
The Virtual Memory Abstraction Memory Management Physical Memory Unprotected address space Limited size Shared physical frames Easy to share data Virtual Memory Programs are isolated Arbitrary size All
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 informationRole of OS in virtual memory management
Role of OS in virtual memory management Role of OS memory management Design of memory-management portion of OS depends on 3 fundamental areas of choice Whether to use virtual memory or not Whether to use
More informationChapter 9: Virtual Memory
Chapter 9: Virtual Memory Background Demand Paging Chapter 9: Virtual Memory Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 29: an Introduction to Virtual Memory Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Virtual memory used to protect applications
More informationChapter 10: Virtual Memory. Background
Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples 10.1 Background Virtual memory separation of user logical
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 informationComputer Architecture. Lecture 8: Virtual Memory
Computer Architecture Lecture 8: Virtual Memory Dr. Ahmed Sallam Suez Canal University Spring 2015 Based on original slides by Prof. Onur Mutlu Memory (Programmer s View) 2 Ideal Memory Zero access time
More informationMotivation. Memory Management. Memory Management. Computer Hardware Review
Memory Management Motivation Vera Goebel Department of Informatics, University of Oslo with slides from: C. Griwodz (Ifi/UiO), P. Halvorsen (Ifi/UiO), K. Li (Princeton), A. Tanenbaum (VU Amsterdam), and
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 informationTopics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems
Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems Instructor: Dr. Turgay Korkmaz Department Computer Science The University of Texas at San Antonio Office: NPB
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 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 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 informationChapter 10: Virtual Memory. Background. Demand Paging. Valid-Invalid Bit. Virtual Memory That is Larger Than Physical Memory
Chapter 0: Virtual Memory Background Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples Virtual memory separation of user logical memory
More informationOperating Systems CSE 410, Spring Virtual Memory. Stephen Wagner Michigan State University
Operating Systems CSE 410, Spring 2004 Virtual Memory Stephen Wagner Michigan State University Virtual Memory Provide User an address space that is larger than main memory Secondary storage is used to
More informationImproving Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Highly-Associative Caches
Improving Cache Performance and Memory Management: From Absolute Addresses to Demand Paging 6.823, L8--1 Asanovic Laboratory for Computer Science M.I.T. http://www.csg.lcs.mit.edu/6.823 Highly-Associative
More informationMemory management: outline
Memory management: outline Concepts Swapping Paging o Multi-level paging o TLB & inverted page tables 1 Memory size/requirements are growing 1951: the UNIVAC computer: 1000 72-bit words! 1971: the Cray
More information