Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory
|
|
- Elisabeth Neal
- 5 years ago
- Views:
Transcription
1 Multi-Process Systems: Memory (2) What we will learn A detailed description of various ways of organizing memory Discuss various memory-management techniques, including paging and segmentation To provide a description hardware support Address space augmentation: Swapping Address space augmentation: Virtual Memory Background Demand Paging Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations Operating-System Examples 2 Memory & paging structures Page 0 Page 1 Page 2 Page 3 Page 4 Logical memory (P0) Page 0 Page 1 Logical memory (P1) Page (P0) 8 0 Page (P1) Page frame number Free pages Physical memory Page 1 (P1) Page 4 (P0) Page 1 (P0) Page 2 (P0) Page 0 (P0) Page 0 (P1) Page 3 (P0) Memory & paging structures: free frames Before allocation After allocation 4
2 Implementing page s in software typedef struct { unsigned int frame:22; unsigned int bit : 1; /* 1 => frame is valid */ unsigned int dirty: 1; /* 1 => frame has been updated; needs writing */ unsigned int ref : 1; /* 1 => the page has been referenced */ int cnt; /* how many references */ int first_time; /* swap-in time for page */ int last_time; /* last time referenced */ } page_entry; typedef struct { page_entry entries[maxpages]; } page_; typedef struct { int page; } frame_entry; typedef struct { frame_entry entries[maxframes]; } frame_; page_ *PTBR; frame_ *FTBR; 5 Implementing page s in hardware Page resides in main (physical) memory CPU uses special registers for paging Page base register (PTBR) points to the page Page length register (PTLR) contains length of page : restricts maximum legal logical address Translating an address requires two memory accesses First access reads page entry (PTE) Second access reads the data / instruction from memory Reduce number of memory accesses Can t avoid second access (we need the value from memory) Eliminate first access by keeping a hardware cache (called a translation lookaside buffer or TLB) of recently used page entries Operating Systems and 6 Distributed Systems Implementing page s in hardware Translation Lookaside Buffer (TLB) Search the TLB for the desired logical page number Search entries in parallel Use standard cache techniques If desired logical page number is found, get frame number from TLB If desired logical page number isn t found Get frame number from page in memory Replace an entry in the TLB with the logical & physical page numbers from this reference Logical page # 8 unused Physical frame # Example TLB 7 Operating Systems and 8 Distributed Systems
3 TLB: Associative Memory Paging Hardware With TLB Page # Frame # Associative memory parallel search Handling TLB misses If PTE isn t found in TLB, OS needs to do the lookup in the page Lookup can be done in hardware or software Hardware TLB replacement CPU hardware does page lookup Can be faster than software Less flexible than software, and more complex hardware Software TLB replacement OS gets TLB exception Exception handler does page lookup & places the result into the TLB Program continues after return from exception Larger TLB (lower miss rate) can make this feasible 11 How long do memory accesses take? Assume the following times: TLB lookup time = T TLB (often zero overlapped in CPU) Memory access time = TMEM Hit ratio (h) is percentage of time that a logical page number is found in the TLB Larger TLB usually means higher h TLB structure can affect h as well Effective access time (an average) is calculated as: EAT = (T MEM + T TLB)h + (T MEM + T MEM + T TLB)(1-h) EAT = T TLB + (2-h) T MEM Interpretation Reference always requires TLB lookup, 1 memory access TLB misses also require an additional memory reference Operating Systems and 12Distributed Systems
4 Memory Protection Memory protection implemented by associating protection bit with each frame Valid-invalid bit attached to each entry in the page : valid indicates that the associated page is in the process logical address space, and is thus a legal page invalid indicates that the page is not in the process logical address space Memory Protection Protection D R V Page frame number Valid bit Shared Pages Shared Pages Example Shared code One copy of read-only (re-entrant) code shared among processes (ie, text editors, compilers, window systems) Shared code must appear in same location in the logical address space of all processes Private code and data Each process keeps a separate copy of the code and data The pages for the private code and data can appear anywhere in the logical address space
5 Structure of the Page Table Hierarchical Paging Hashed Page Tables Inverted Page Tables Hierarchical Page Tables Break up the logical address space into multiple page s A simple technique is a two-level page Two-level page s Two-level paging: example Problem: page s can be too large 2 32 bytes in 4KB pages need 1 million PTEs Solution: use multi-level page s Page size in first page is large (megabytes) PTE marked invalid in first page needs no 2nd level page 1st level page has pointers to 2nd level page s 2nd level page has actual physical page numbers in it 1st level page 2nd level page s main memory System characteristics 8 KB pages 32-bit logical address divided into 13 bit page offset, 19 bit page number Page number divided into: 10 bit page number (p1) 9 bit page offset (p2) Logical address looks like this: p 1 is an index into the 1st level page p 2 is an index into the 2nd level page pointed to by p 1 page number page offset p 1 = 10 bits p 2 = 9 bits offset = 13 bits Operating Systems and 19Distributed Systems Operating Systems and 20Distributed Systems
6 2-level address translation example Page base page number page offset p 1 = 10 bits p 2 = 9 bits offset = 13 bits 0 1 p 1 1st level page 0 1 p 2 2nd level page physical address frame number main memory More on two-level page s Trade-off between 1st and 2nd level page sizes Total number of bits indexing 1st and 2nd level is constant for a given page size and logical address length Trade-off between number of bits indexing 1st and number indexing 2nd level s More bits in 1st level: fine granularity at 2nd level Fewer bits in 1st level: maybe less wasted space? All addresses in are physical addresses Protection bits kept in 2nd level 22 Hashed Page Tables Hashed Page Table Common in address spaces > 32 bits The virtual page number is hashed into a page This page contains a chain of elements hashing to the same location Virtual page numbers are compared in this chain searching for a match If a match is found, the corresponding physical frame is extracted
7 Inverted page Reduce page size further: keep one entry for each frame in memory Alternative: merge s for pages in memory and on disk PTE contains Virtual address pointing to this frame Information about the process that owns this page Search page by Hashing the virtual page number and process ID Starting at the entry corresponding to the hash result Search until either the entry is found or a limit is reached Page frame number is index of PTE Improve performance by using more advanced hashing algorithms 25 Inverted page architecture page number process ID p = 19 bits offset = 13 bits pid p search 0 1 k pid 0 pid 1 pid k p 0 p 1 p k inverted page page offset physical address k Page frame number 0 1 main memory Augmenting address space The big picture Swappig Virtual Memory Page request Page replacement Frame allocation User s View of a Program Process address space Memory organization (allocation) Non contiguous allocation Contiguous allocation Fixed dimension Variable dimension Variable partitioning Fixed partitioning Paging Segmentation Dynamic allocation Table based partitioning Paging & Segmentation HW support Limit & relocation registers Dedicated registers Page TLB Segment
8 Segmentation Why use segmentation? Memory-management scheme that supports user view of memory A program is a collection of segments A segment is a logical unit such as:!! main program,!! procedure,!! function,!! method,!! object,!! local variables, global variables,!! common block,!! stack,!! symbol, arrays Allocated Virtual address space Call stack Constants Source text Symbol In use Different units in a single virtual address space Each unit can grow How can they be kept apart? Example: symbol is out of space Solution: segmentation Give each unit its own address space Operating Systems and 30Distributed Systems Using segments Each region of the process has its own segment Each segment can start at 0 Addresses within the segment relative to the segment start Virtual addresses are <segment #, offset within segment> 20K 16K 12K 8K 4K Symbol 0K Segment 0 16K 12K 8K 4K Source text 0K Segment 1 8K 4K Constants 0K Segment 2 12K 8K 4K Call stack 0K Segment 3 Segmentation model Unit of memory movement is: Variably sized Defined by the programmer Two component addresses, <Seg#, offset> Address translation is more complex than paging B t : segments x offsets! Physical Address " {#} B t (i, j) = k Operating Systems and 31Distributed Systems
9 Segmentation model: Segment Address Translation B t : segments x offsets! physical address " {#} B t (i, j) = k S: segments! segment addresses B t (S(segName), j) = k N: offset names! offset addresses B t (S(segName), N(offsetName)) = k Address Translation in Segmentation Missing segment <segmentname, offsetname> S N segment # offset? B t Limit Base P Limit Relocation + To Memory Address Register Paging vs segmentation What? Paging Segmentation Need the programmer know about it? How many linear address spaces? More addresses than physical memory? Separate protection for different objects? Variable-sized objects handled with ease? No Operating Systems and 35Distributed Systems Yes 1 Many Yes No No Yes Yes Yes Is sharing easy? No Yes Why use it? More address space without buying more memory Break programs into logical pieces that are handled separately Hardware implementation Segmentation requires special hardware Segment descriptor support Segment base registers (segment, code, stack) Translation hardware Some of translation can be static No dynamic offset name binding Limited protection
10 Segmentation Hardware Segmentation Architecture (Cont) Protection With each entry in segment associate: validation bit = 0 $ illegal segment read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level Since segments vary in length, memory allocation is a dynamic storage-allocation problem A segmentation example is shown in the following diagram Example of Segmentation Implementing segmentation Segment 3 (10 KB) Segment 2 (4 KB) Segment 1 (12 KB) Segment 3 (10 KB) Segment 2 (4 KB) Segment 4 (7 KB) 5 KB free Segment 5 (6 KB) 4 KB free Segment 2 (4 KB) Segment 4 (7 KB) 5 KB free Segment 6 (8 KB) Segment 9 KB free6 (8 KB) Segment 5 (6 KB) Segment 2 (4 KB) Segment 4 (7 KB) Segment 0 (6 KB) Segment 0 (6 KB) Segment 0 (6 KB) Segment 0 (6 KB) => Need to do memory compaction! Operating Systems and 40Distributed Systems
11 Segmentation: summary Segmentation Architecture Logical address consists of a pair: <segment-number, offset>, Segment maps two-dimensional physical addresses; each entry has: base contains the starting physical address where the segments reside in memory limit specifies the length of the segment Segment- base register (STBR) points to the segment s location in memory Segment- length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR Relocation dynamic by segment Sharing shared segments same segment number Allocation first fit/best fit external fragmentation Protection With each entry in segment associate: validation bit = 0 illegal segment read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level Since segments vary in length, memory allocation is a dynamic storage-allocation problem Better: segmentation and paging Operating Systems and 42Distributed Systems Example: The Intel Pentium Supports both segmentation and segmentation with paging CPU generates logical address Given to segmentation unit Which produces linear addresses Linear address given to paging unit Which generates physical address in main memory Paging units form equivalent of MMU Memory management in the Pentium Memory composed of segments Segment pointed to by segment descriptor Segment selector used to identify descriptor Segment descriptor describes segment Base virtual address Size Protection Code / data Operating Systems and 44Distributed Systems
12 Logical to Physical Address Translation in Pentium Pentium Paging Architecture Pentium has 6 segment registers CS, SS, DS, ES, FS, GS Also has 6 microprogram registers to hold the associated segment descriptor to avoid memory refs on each translation A segment register holds a segment "selector" A selector is 16 bits and uses 13 to hold the segment index (s), 1 bit for the gdt/ldt switch (g), and 2 bits for the privilege level (p) The gdt/ldt switch is used to select between the GDT (one for the entire system and shared between all processes) and the LDT (private to the process) Given the, use (s) to index into the Intel Pentium Segmentation Unit Pentium Paging Architecture Segment selector used to identify descriptor Segment pointed to by segment descriptor Segment descriptor describes segment
13 Process address space Augmenting address space Memory organization (allocation) HW support The big picture Non contiguous allocation Contiguous allocation Swappig Virtual Memory Limit & relocation registers Page request Page replacement Fixed dimension Variable dimension Variable partitioning Fixed partitioning Dedicated registers Paging Segmentation Dynamic allocation Table based partitioning Page Frame allocation TLB Paging & Segmentation Segment Augmentation strategies: Swapping Supported by dynamic memory allocation Suppose there is high demand for execu memory Equi policy might be to time-multiplex processes into the memory (also spacemux) Means that process can have its address space unloaded when it still needs memory Usually only happens when it is blocked Swapping Swapping: leaving room to grow B B B B A A A A D D D OS OS OS OS OS OS OS Memory allocation changes as Processes come into memory Processes leave memory Swapped to disk Complete execution Gray regions are unused memory C C C C C Need to allow for programs to grow Allocate more memory for data Larger stack Handled by allocating more space than is necessary at the start Inefficient: wastes memory that s not currently in use What if the process requests too much memory? Process B Process A Stack Data Code Stack Data Code OS Room for B to grow Room for A to grow Operating Systems and 51Distributed Systems Operating Systems and 52Distributed Systems
14 Limitations of swapping Problems with swapping Process must fit into physical memory (impossible to run larger processes) Memory becomes fragmented External fragmentation: lots of small free areas Compaction needed to reassemble larger free areas Processes are either in memory or on disk: half and half doesn t do any good Overlays solved the first problem Bring in pieces of the process over time (typically data) Still doesn t solve the problem of fragmentation or partially resident processes 53 Process address space Augmenting address space Memory organization (allocation) HW support The big picture Contiguous allocation Swappig Virtual Memory Non contiguous allocation Limit & relocation registers Page request Page replacement Fixed dimension Variable dimension Variable partitioning Fixed partitioning Dedicated registers Paging Segmentation Dynamic allocation Table based partitioning Page Frame allocation TLB Paging & Segmentation Segment Virtual Memory Virtual memory separation of user logical memory from physical memory Only part of the program needs to be in memory for execution Logical address space can therefore be much larger than physical address space Allows address spaces to be shared by several processes Allows for more efficient process creation Virtual Memory Every process has code and data locality Code tends to execute in a few fragments at one time Tend to reference same set of data structures Dynamically load/unload currently-used address space fragments as the process executes Uses dynamic address relocation/binding Generalization of base-limit registers Physical address corresponding to a compiletime address is not bound until run time
15 Size of Blocks of Memory Virtual Memory That is Larger Than Physical Memory Virtual memory system transfers blocks of the address space to/from primary memory Fixed size blocks: System-defined pages are moved back and forth between primary and secondary memory Variable size blocks: Programmer-defined segments corresponding to logical fragments are the unit of movement Paging is the commercially dominant form of virtual memory today $ Shared Library Using Virtual Memory Demand Paging Bring a page into memory only when it is needed Less I/O needed Less memory needed Faster response More users Page is needed $ reference to it invalid reference $ abort not-in-memory $ bring to memory Lazy swapper never swaps a page into memory unless page will be needed Swapper that deals with pages is a pager
16 Transfer of a Paged Memory to Contiguous Disk Space Valid-Invalid Bit With each page entry a valid invalid bit is associated (v $ in-memory, i $ not-in-memory) Initially valid invalid bit is set to i on all entries Frame # page valid-invalid bit v v v v i i i During address translation, if valid invalid bit in page entry is I $ page fault Page Table When Some Pages Are Not in Main Memory Page Fault If there is a reference to a page, first reference to that page will trap to operating system: page fault 1 Operating system looks at another to decide:! Invalid reference $ abort! Just not in memory 2 Get empty frame 3 Swap page into frame 4 Reset s 5 Set validation bit = v 6 Restart the instruction that caused the page fault
17 How is a page fault handled? Hardware causes a page fault General registers saved (as on every exception) OS determines which virtual page needed Actual fault address in a special register Address of faulting instruction in register Page fault was in fetching instruction, or Page fault was in fetching operands for instruction OS must figure out which 65 OS checks validity of address Process killed if address was illegal OS finds a place to put new page frame If frame selected for replacement is dirty, write it out to disk OS requests the new page from disk Page s updated Faulting instruction backed up so it can be restarted Faulting process scheduled Registers restored Program continues Steps in Handling a Page Fault Backing up an instruction Problem: page fault happens in the middle of instruction execution Some changes may have already happened Others may be waiting for VM to be fixed Solution: undo all of the changes made by the instruction Restart instruction from the beginning This is easier on some architectures than others Example: LW R1, 12(R2) Page fault in fetching instruction: nothing to undo Page fault in getting value at 12(R2): restart instruction Example: ADD (Rd)+,(Rs1)+,(Rs2)+ Page fault in writing to (Rd): may have to undo an awful lot Performance of Demand Paging Page Fault Rate: probability 0 % p % 10 if p = 0 no page faults if p = 1, every reference is a fault Effective Access Time (EAT)!! EAT = (1 p) x memory access!!! + p x (page fault overhead!!! + swap page out!!! + swap page in!!! + restart overhead ) Operating Systems and 67Distributed Systems
18 Demand Paging: Example Process Creation Memory access time = 200 nanoseconds Average page-fault service time = 8 milliseconds Compute EAT and slowdown factor assuming that one access out of 1,000 causes a page fault EAT = (1 p) x p (8 milliseconds)! = (1 p) x p x 8,000,000 = p x 7,999,800 If one access out of 1,000 causes a page fault, then EAT = 82 microseconds This is a slowdown by a factor of 40!! " Virtual memory allows other benefits during process creation:! - Copy-on-Write! - Memory-Mapped Files (later) Copy-on-Write Copy-on-Write (COW) allows both parent and child processes to initially share the same pages in memory If either process modifies a shared page, only then is the page copied COW allows more efficient process creation as only modified pages are copied Free pages are allocated from a pool of zeroed-out pages
8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management
Part Four - Memory Management 8.1 Background Chapter 8: Memory-Management Management Strategies Program must be brought into memory and placed within a process for it to be run Input queue collection of
More informationModule 8: Memory Management
Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts 8.1 Silberschatz and Galvin
More informationMemory Management. Memory Management
Memory Management Gordon College Stephen Brinton Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 1 Background Program must be brought into memory
More informationPart Three - Memory Management. Chapter 8: Memory-Management Strategies
Part Three - Memory Management Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies 8.1 Background 8.2 Swapping 8.3 Contiguous Memory Allocation 8.4 Segmentation 8.5 Paging 8.6
More informationChapter 9: Memory Management. Background
1 Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory and placed within a process for
More informationChapter 8: Memory Management
Chapter 8: Memory Management Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.2 Background Program must be brought into memory and placed
More informationChapter 8 & Chapter 9 Main Memory & Virtual Memory
Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array
More informationCHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.
CHAPTER 8: MEMORY MANAGEMENT By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the
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 informationI.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY
I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY MANAGEMENT Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of
More informationOperating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy
Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference
More informationGoals of Memory Management
Memory Management Goals of Memory Management Allocate available memory efficiently to multiple processes Main functions Allocate memory to processes when needed Keep track of what memory is used and what
More informationI.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY
I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY MANAGEMENT Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the
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 informationCS307: Operating Systems
CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn
More informationChapter 8: Main Memory
Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 8.2 Silberschatz, Galvin
More informationCS3600 SYSTEMS AND NETWORKS
CS3600 SYSTEMS AND NETWORKS SPRING 2013 Lecture 13: Paging Prof. Alan Mislove (amislove@ccs.neu.edu) Paging Physical address space of a process can be noncontiguous; process is allocated physical memory
More informationChapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition
Chapter 7: Main Memory Operating System Concepts Essentials 8 th Edition Silberschatz, Galvin and Gagne 2011 Chapter 7: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure
More informationChapter 8: Memory- Manage g me m nt n S tra r t a e t gie i s
Chapter 8: Memory- Management Strategies Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2009/12/16
More informationModule 8: Memory Management
Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.1 Background Program must be brought into memory
More informationChapter 8: Memory-Management Strategies
Chapter 8: Memory-Management Strategies Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and
More informationCSE325 Principles of Operating Systems. Virtual Memory. David P. Duggan. March 7, 2013
CSE325 Principles of Operating Systems Virtual Memory David P. Duggan dduggan@sandia.gov March 7, 2013 Reading Assignment 9 Chapters 10 & 11 File Systems, due 3/21 3/7/13 CSE325 - Virtual Memory 2 Outline
More informationModule 9: Memory Management. Background. Binding of Instructions and Data to Memory
Module 9: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory
More informationPage Table Structure. Hierarchical Paging. Hashed Page Tables. Inverted Page Tables
Page Table Structure Hierarchical Paging Hashed Page Tables Inverted Page Tables 1 Hierarchical Page Tables Problem: for very large logical address spaces (2 32 and 2 64 ) the page table itself becomes
More informationChapter 8: Main Memory
Chapter 8: Main Memory Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 8: Memory Management Background" Swapping " Contiguous Memory Allocation" Paging" Structure
More informationCS 3733 Operating Systems:
CS 3733 Operating Systems: Topics: Memory Management (SGG, Chapter 08) Instructor: Dr Dakai Zhu Department of Computer Science @ UTSA 1 Reminders Assignment 2: extended to Monday (March 5th) midnight:
More informationLogical versus Physical Address Space
CHAPTER 8: MEMORY MANAGEMENT Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts, Addison-Wesley 1994
More informationSHANDONG UNIVERSITY 1
Chapter 8 Main Memory SHANDONG UNIVERSITY 1 Contents Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium SHANDONG UNIVERSITY 2 Objectives
More informationCHAPTER 8 - MEMORY MANAGEMENT STRATEGIES
CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES OBJECTIVES Detailed description of various ways of organizing memory hardware Various memory-management techniques, including paging and segmentation To provide
More informationChapter 8: Main Memory. Operating System Concepts 9 th Edition
Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel
More informationChapter 8: Memory Management Strategies
Chapter 8: Memory- Management Strategies, Silberschatz, Galvin and Gagne 2009 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table
More informationMemory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts
Memory management Last modified: 26.04.2016 1 Contents Background Logical and physical address spaces; address binding Overlaying, swapping Contiguous Memory Allocation Segmentation Paging Structure of
More informationChapter 8: Main Memory
Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel
More informationChapter 8 Main Memory
COP 4610: Introduction to Operating Systems (Spring 2014) Chapter 8 Main Memory Zhi Wang Florida State University Contents Background Swapping Contiguous memory allocation Paging Segmentation OS examples
More informationMain Memory. CISC3595, Spring 2015 X. Zhang Fordham University
Main Memory CISC3595, Spring 2015 X. Zhang Fordham University 1 Memory Management! Background!! Contiguous Memory Allocation!! Paging!! Structure of the Page Table!! Segmentation!! Example: The Intel Pentium
More informationMemory Management. Memory
Memory Management These slides are created by Dr. Huang of George Mason University. Students registered in Dr. Huang s courses at GMU can make a single machine readable copy and print a single copy of
More informationFile Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.
File Systems I/O Management Hard Drive Management Virtual Memory Swap Memory Management Storage and I/O Introduction CSI3131 Topics Process Management Computing Systems Memory CPU Peripherals Processes
More informationChapter 8: Main Memory
Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:
More informationLecture 8 Memory Management Strategies (chapter 8)
Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 8 Memory Management Strategies (chapter 8) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The
More informationCS307 Operating Systems Main Memory
CS307 Main Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Background Program must be brought (from disk) into memory and placed within a process
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 informationChapter 8 Memory Management
Chapter 8 Memory Management Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 Outline Background Swapping Contiguous
More informationPrinciples of Operating Systems
Principles of Operating Systems Lecture 18-20 - Main Memory Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and
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 informationMemory Management and Protection
Part IV Memory Management and Protection Sadeghi, Cubaleska RUB 2008-09 Course Operating System Security Memory Management and Protection Main Memory Virtual Memory Roadmap of Chapter 4 Main Memory Background
More informationMemory Management. CSCI 315 Operating Systems Design Department of Computer Science
Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,
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 informationChapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition
Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 20 Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Pages Pages and frames Page
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 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 information현재이이미지를표시할수없습니다. Chapter 9: Virtual Memory
현재이이미지를표시할수없습니다. Chapter 9: Virtual Memory Objectives To describe the benefits of a virtual memory system To explain the concepts of demand paging, page-replacement algorithms, and allocation of page frames
More informationChapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition
Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation
More informationChapter 8: Memory- Management Strategies
Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and
More informationChapter 8: Main Memory. Operating System Concepts 8th Edition
Chapter 8: Main Memory Operating System Concepts 8th Edition Silberschatz, Galvin and Gagne 2009 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page
More informationMain Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1
Main Memory Electrical and Computer Engineering Stephen Kim (dskim@iupui.edu) ECE/IUPUI RTOS & APPS 1 Main Memory Background Swapping Contiguous allocation Paging Segmentation Segmentation with paging
More informationChapter 8: Memory Management. Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging
Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 1 Background Memory management is crucial in better utilizing one of the most important
More informationMemory Management. Contents: Memory Management. How to generate code? Background
TDIU11 Operating systems Contents: Memory Management Memory Management [SGG7/8/9] Chapter 8 Background Relocation Dynamic loading and linking Swapping Contiguous Allocation Paging Segmentation Copyright
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 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 informationModeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems
Modeling Page Replacement: Stack Algorithms 7 4 6 5 State of memory array, M, after each item in reference string is processed CS450/550 Memory.45 Design Issues for Paging Systems Local page replacement
More informationBackground Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation
Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Basic Hardware Address Binding Logical VS Physical Address Space Dynamic Loading Dynamic Linking and Shared
More informationCSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018
CSE 4/521 Introduction to Operating Systems Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018 Overview Objective: To describe the benefits of a virtual memory system. To explain the concept
More informationOutline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables
Outline V22.0202-001 Computer Systems Organization II (Honors) (Introductory Operating Systems) Lecture 15 Memory Management (cont d) Virtual Memory March 30, 2005 Announcements Lab 4 due next Monday (April
More informationMain Memory (II) Operating Systems. Autumn CS4023
Operating Systems Autumn 2017-2018 Outline 1 Main Memory (II) Outline Main Memory (II) 1 Main Memory (II) Paging Main Memory (II) Physical address space of a process can be noncontiguous; process is allocated
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 informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 17: Paging Lecture Overview Recap: Today: Goal of virtual memory management: map 2^32 byte address space to physical memory Internal fragmentation
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 informationMain Memory (Part II)
Main Memory (Part II) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/17 1 / 50 Reminder Amir H. Payberah
More informationChapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1
Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9: Memory Management Background Swapping Contiguous Memory Allocation Segmentation
More informationVII. Memory Management
VII. Memory Management 1 Intended Schedule Date Lecture Hand out Submission 0 20.04. Introduction to Operating Systems Course registration 1 27.04. Systems Programming using C (File Subsystem) 1. Assignment
More informationMain Memory Yi Shi Fall 2017 Xi an Jiaotong University
Main Memory Yi Shi Fall 2017 Xi an Jiaotong University Goals Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Background Program must be brought (from disk)
More informationOperating System 1 (ECS-501)
Operating System 1 (ECS-501) Unit- IV Memory Management 1.1 Bare Machine: 1.1.1 Introduction: It has the ability to recover the operating system of a machine to the identical state it was at a given point
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 informationCS399 New Beginnings. Jonathan Walpole
CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,
More informationOperating Systems. Paging... Memory Management 2 Overview. Lecture 6 Memory management 2. Paging (contd.)
Operating Systems Lecture 6 Memory management 2 Memory Management 2 Overview Paging (contd.) Structure of page table Shared memory Segmentation Segmentation with paging Virtual memory Just to remind you...
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 informationPage Size Page Size Design Issues
Paging: design and implementation issues 1 Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small
More information6 - Main Memory EECE 315 (101) ECE UBC 2013 W2
6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 Acknowledgement: This set of slides is partly based on the PPTs provided by the Wiley s companion website (including textbook images, when not explicitly
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 informationLearning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.
Virtual Memory 1 Learning Outcomes An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory. 2 Memory Management Unit (or TLB) The position and function
More informationOutlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium
Main Memory Outlook Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2 Backgound Background So far we considered how to share
More informationLearning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.
Virtual Memory Learning Outcomes An understanding of page-based virtual memory in depth. Including the R000 s support for virtual memory. Memory Management Unit (or TLB) The position and function of the
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 informationOperating Systems, Fall Lecture 5 1
Paging: design and implementation issues 1 Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small
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 informationMemory and multiprogramming
Memory and multiprogramming COMP342 27 Week 5 Dr Len Hamey Reading TW: Tanenbaum and Woodhull, Operating Systems, Third Edition, chapter 4. References (computer architecture): HP: Hennessy and Patterson
More informationMemory management, part 3: outline
Memory management, part 3: outline Segmentation Case studies o MULTICS o x86 (Pentium) o Unix o Linux o Windows 1 Segmentation Several address spaces per process a compiler needs segments for o source
More informationMemory management, part 3: outline
Memory management, part 3: outline Segmentation Case studies o MULTICS o Pentium o Unix o Linux o Windows 1 Segmentation Several address spaces per process a compiler needs segments for o source text o
More informationP r a t t hr h ee e : e M e M m e o m r o y y M a M n a a n g a e g m e e m n e t 8.1/72
Part three: Memory Management programs, together with the data they access, must be in main memory (at least partially) during execution. the computer keeps several processes in memory. Many memory-management
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 Systems, Fall Lecture 5 1. Overhead due to page table and internal fragmentation. Tbl 8.2 [Stal05] 4.
Paging: design and implementation issues Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small
More informationChapter 8 Main Memory
Chapter 8 Main Memory 8.1, 8.2, 8.3, 8.4, 8.5 Chapter 9 Virtual memory 9.1, 9.2, 9.3 https://www.akkadia.org/drepper/cpumemory.pdf Images from Silberschatz Pacific University 1 How does the OS manage memory?
More informationVirtual Memory: Mechanisms. CS439: Principles of Computer Systems February 28, 2018
Virtual Memory: Mechanisms CS439: Principles of Computer Systems February 28, 2018 Last Time Physical addresses in physical memory Virtual/logical addresses in process address space Relocation Algorithms
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 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 super big to hold a program
More informationChapter 9: Virtual-Memory Management. Operating System Concepts 8 th Edition,
Chapter 9: Virtual-Memory Management, Silberschatz, Galvin and Gagne 2009 Chapter 9: Virtual-Memory Management Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped
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 informationRecall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory
Recall: Address Space Map 13: Memory Management Biggest Virtual Address Stack (Space for local variables etc. For each nested procedure call) Sometimes Reserved for OS Stack Pointer Last Modified: 6/21/2004
More information