# Optimizing Dynamic Memory Management!

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Otimizing Dynamic Memory Management! 1 Goals of this Lecture! Hel you learn about:" Details of K&R hea manager" Hea manager otimizations related to Assignment #6" Other hea manager otimizations" 2 1

2 Part 1:" Details of the K&R Hea Manager" 3 An Imlementation Challenge! Problem: for linked list of free blocks, need information about each free block" Starting address of the block of memory" Size of the free block" Pointer to the next block in the free list" Where should this information be stored?" Number of free blocks is not known in advance" So, need to store the information on the hea! But, wait, this code is what imlements the management of the hea (malloc and free)" Can t call malloc() to allocate storage for these data" Can t call free() to deallocate the storage either" 4 2

3 Store formation in the Free Block! " Solution:" Store the information directly in the block" 5 Block Headers! Every free block has a header, containing:" Pointer to (i.e., address of) the next free block" Size of the free block" header (address returned to the r by malloc()) size r data 6 3

4 Free List: Circular Linked List! Free blocks, linked together" Examle: circular linked list" Kee list in order of increasing addresses" Makes it easier to coalesce adjacent free blocks" Free list 7 Malloc: First-Fit Algorithm! Start at the beginning of the list" Sequence through the list" Kee a ointer to the revious element" Sto when reaching first block that is big enough" Patch u the list" Return a ointer to the r" rev rev 8 4

5 Malloc: First Case: Perfect Fit! Suose the first fit is a erfect fit" Remove the block from the list" Link the revious free block with the next free block" Return the current to the r (skiing header)" rev +1 9 Malloc: Second Case: Big Block! Suose the block is bigger than requested" Divide the free block into two blocks" Kee first (now smaller) block in the free list" Allocate the second block to the r" Why not allocate the first block to the r?" 10 5

6 Free! User asses a ointer to the memory block " void free(void *a); free() function inserts block into the list" Identify the start of block to be inserted (*b)" Find the location in the free list" Add to the list, coalescing entries, if needed" b a 11 Free: Finding Location to sert! Start at the beginning! Sequence through the list! Sto at last entry before the to-be-freed element" Free list b FREE ME 12 6

7 Free: Handling Corner Cases! Check for wra-around in memory" b is at lower address than first entry in the free list, or" b is at higher address than the last entry in the free list" Free list b FREE ME 13 Free: serting to Free List! New element to add to free list sert in between revious and next entries But, there may be oortunities to coalesce" b ->s.tr 14 7

8 Coalescing With Neighbors! Scanning the list finds the location for inserting" Pointer to to-be-freed element: b Pointer to revious element in free list: Coalescing into larger free blocks" Check if contiguous to uer and lower neighbors" Free list b lower FREE ME uer 15 Coalesce With Uer Neighbor! Check if next art of memory is in the free list" If so, make into one bigger block Else, simly oint to the next free element b ->s.tr uer ->s.tr 16 8

9 Coalesce With Lower Neighbor! Check if revious art of memory is in the free list" If so, make into one bigger block b ->s.tr lower ->s.tr 17 Strengths of K&R Aroach! Advantages" Simlicity of the code" Otimizations to malloc() Slitting large free block to avoid wasting sace" Otimization to free() Roving free-list ointer is left at the last lace a block was allocated" Coalescing contiguous free blocks to reduce fragmentation" b ->s.tr uer 18 9

10 Weaknesses of K&R Aroach! efficient of memory: fragmentation" First-fit olicy can leave lots of holes of free blocks in memory" Long execution times: linear-time overhead" malloc() scans the free list to find a big-enough block" free() scans the free list to find where to insert a block" Accessing a wide range of memory addresses in free list" Can lead to large amount of aging to/from the disk" Free list " " " Part 2:" Otimizations Related to Assignment 6" 20 10

11 Faster Free! Performance roblems with K&R free() Scanning the free list to know where to insert" Need to find lace and erhas coalesce quickly" Doubly-linked, non-circular list" Every block has:" Header" Size of the block (in # of units)" Flag indicating whether the block is free or in " If free, a ointer to the next free block" Footer" Size of the block (in # of units)" If free, a ointer to the revious free block" h e a d f o o t 21 Size: Finding Next Block! Go quickly to next block in memory" Start with the r s data ortion of the block" Go backwards to the head of the block" Easy, since you know the size of the header" Go forward to the head of the next block" Easy, since you know the size of the current block" 22 11

12 Size: Finding Previous Block! Go quickly to revious block in memory" Start with the r s data ortion of the block" Go backwards to the head of the block" Easy, since you know the size of the header" Go backwards to the footer of the revious block" Easy, since you know the size of the footer" Go backwards to the header of the revious block" Easy, since you know the size from the footer" 23 Pointers: Next Free Block! Go quickly to next free block in memory" Start with the r s data ortion of the block" Go backwards to the head of the block" Easy, since you know the size of the header" Go forwards to the next free block" Easy, since you have the next free ointer" 24 12

13 Pointers: Previous Free Block! Go quickly to revious free block in memory" Start with the r s data ortion of the block" Go backwards to the head of the block" Easy, since you know the size of the header" Go forwards to the footer of the block" Easy, since you know the block size from the header" Go backwards to the revious free block" Easy, since you have the revious free ointer" 25 Efficient Free! Before: K&R" Scan the free list till you find the lace to insert" Needed to see if you can coalesce adjacent blocks" Exensive for loo with several ointer comarisons" After: with header/footer and doubly-linked list" Coalescing with the revious block in memory" Check if revious block in memory is also free" If so, coalesce" Coalescing with the next block in memory the same way" Add the new, larger block to the front of the linked list" 26 13

14 But Malloc is Still Slow! Still need to scan the free list" To find the first, or best, block that fits" Root of the roblem" Free blocks have a wide range of sizes" Solution: binning" Searate free lists by block size" Imlemented as an array of free-list ointers" 27 Binning Strategies: Exact Fit! Have a bin for each block size, u to a limit" Adv: no search for requests that are u to that size" Disadv: many bins, each storing a ointer" Excet for a final bin for all larger free blocks" For allocating larger amounts of memory" For slitting to create smaller blocks, when needed" >

15 Binning Strategies: Range! Have a bin cover a range of sizes, u to a limit" Advantages: fewer bins" Disadvantages: need to search for a big enough block" Excet for a final bin for all larger free chunks" For allocating larger amounts of memory" For slitting to create smaller blocks, when needed" > Suggestions for Assignment #6! Debugging memory management code is hard" A bug in your code might stom on the headers or footers" making it very hard to understand where you are in memory" Suggestion: debug carefully as you go along" Write little bits of code at a time, and test as you go" Use assertion checks very liberally to catch mistakes early" Use functions to aly higher-level checks on your list" E.g,. all free-list blocks are marked as free" E.g., each block ointer is within the hea range" E.g., the block size in header and footer are the same" Suggestion: draw lots and lots of ictures" 30 15

16 " " " Part 3:" Other Otimizations" 31 Best/Good Fit Block Selection! Observation:" K&R s first fit (really, next fit ) strategy" Examle: malloc(8) would choose the 20-byte block" Alternative: best fit or good fit strategy" Examle: malloc(8) would choose the 8-byte block" Alicable if not binning, or if a bin has blocks of variable sizes" Pro: Minimizes internal fragmentation and slitting" Con: creases cost of choosing free block" Free list

17 Selective Slitting! Observation:" K&R malloc() slits whenever chosen block is too big" Examle: malloc(14) slits the 20-byte block" Alternative: selective slitting! Slit only when the saving is big enough" Examle: malloc(14) allocates the entire 20-byte block" Pro: Reduces work" Con: creases internal fragmentation" Free list Deferred Coalescing! Observation:" K&R does coalescing in free() whenever ossible" Alternative: deferred coalescing! Wait, and coalesce many blocks at a later time" Pro: Handles malloc(x);free();malloc(x) sequences well" Con: Comlicates algorithms" Free list b lower FREE ME uer 34 17

18 Segregated Data! Observation:" Slitting and coalescing consume lots of overhead" Problem:" How to eliminate that overhead?" Solution: Segregated data" Make of the virtual memory concet! Store each bin s blocks in a distinct (segregated) virtual memory age" Elaboration " 35 Segregated Data (cont.)! Segregated data" Each bin contains blocks of fixed sizes" E.g. 32, 64, 128, " All blocks within a bin are from same virtual memory age" Malloc never slits. Examles:" Malloc for 32 bytes => rovide 32" Malloc for 5 bytes => rovide 32" Malloc for 100 bytes => rovide 128" Free never coalesces" Free block => examine address, infer virtual memory age, infer bin, insert into that bin" Pro: Comletely eliminates slitting and coalescing overhead" Pro: Eliminates most meta-data; only forward links are required (no backward links, sizes, status bits, footers)" Con: Some usage atterns ca excessive external fragmentation" 36 18

19 Segregated Meta-Data! Observations:" Meta-data (block sizes, status flags, links, etc.) are scattered across the hea, intersersed with r data" Hea mgr often must traverse meta-data" Problem 1:" User error easily can corrut meta-data" Problem 2:" Frequent traversal of meta-data can ca excessive age faults" Solution: Segregated meta-data! Make of the virtual memory concet! Store meta-data in a distinct (segregated) virtual memory age from r data" 37 Memory Maing! Observations:" Hea mgr might want to release hea memory to OS (e.g. for as stack)" Hea mgr can call brk(currentbreak x) to release freed memory to OS, but " Difficult to know when memory at high end of hea is free, and " Often freed memory is not at high end of hea!" Problem:" How can hea mgr effectively release freed memory to OS?" Solution: Memory maing! Make of virtual memory concet! Allocate memory via mma() system call" Free memory via munma() system call" 38 19

20 mma() and munma() Tyical call of mma() = mma(null, size, PROT_READ PROT_WRITE, MAP_PRIVATE MAP_ANON, 0, 0);" Asks the OS to ma a new rivate read/write area of virtual memory containing size bytes" Returns the virtual address of the new area on success, NULL on failure" Tyical call of munma() status = munma(, size);" Unmas the area of virtual memory at virtual address consisting of size bytes" Returns 1 on success, 0 on failure" See Bryant & O Hallaron book and man ages for details" 39 Using mma() and munma() Tyical strategy:" Allocate small block =>" Call brk() if necessary" Maniulate data structures described earlier in this lecture" Free small block =>" Maniulate data structures described earlier in this lecture" Do not call brk() Allocate large block =>" Call mma() Free large block =>" Call munma() 40 20

21 Summary! Details of K&R hea manager" Hea mgr otimizations related to Assignment #6" Faster free() via doubly-linked list, redundant sizes, and status bits" Faster malloc() via binning" Other hea mgr otimizations" Best/good fit block selection" Selective slitting" Deferred coalescing" Segregated data" Segregated meta-data" Memory maing" 41 21

### Dynamic Memory Management

Dynamic Memory Management 1 Goals of this Lecture Help you learn about: The need for dynamic* memory management (DMM) Implementing DMM using the heap section Implementing DMM using virtual memory * During

### Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs

Memory management Chater : Memory Management Part : Mechanisms for Managing Memory asic management Swaing Virtual Page relacement algorithms Modeling age relacement algorithms Design issues for aging systems

### Memory Management. Memory Areas and their use. Memory Manager Tasks: Free List Implementations. acquire release

Memory Management Memory Areas and their use Memory Manager Tasks: acquire release Free List Implementations Singly Linked List Doubly Linked List Buddy Systems Memory Management Memory areas: In languages

### Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

### Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No. # 02 Lecture No. # 05 Run-time Environments-Part 3 and Local Optimizations

### Operating Systems. Memory Management. Memory management

Oerating Systems Memory management Memory Management List of Toics 1. Memory Management 2. Memory In Systems Design 3. Binding Times 4. Introduction to Memory Management 5. Raw Memory Model 6. Single Contiguous

### Last Class: File System Abstraction! Today: File System Implementation!

Last Class: File System Abstraction! Lecture 19, page 1 Today: File System Implementation! Disk management Brief review of how disks work. How to organize data on to disks. Lecture 19, page 2 How Disks

### Memory Management Duties. Overview of Presentation. (User View: code segments) User View: address space

Overview of Presentation responsibilities of a memory manager user view of memory management memory management strategies, algorithms fixed partitions, variable partitions algorithms, fragmentation, coalescing

### Memory Allocation Overview

Memory Allocation Overview Witawas Srisa-an CSCE496/896: Embedded Systems Design and Implementation (Getting Ready for the Final Assignment-part 1) 1 Motivation It has been said in 1998 that Java spends

### CSL373: Lecture 14 User level memory management

CSL373: Lecture 14 User level memory management Today: dynamic memory allocation Almost every useful program uses dynamic allocation: gives wonderful functionality benefits don t have to statically specify

### Last Class: File System Abstraction. Protection

Last Class: File System Abstraction Naming Protection Persistence Fast access Lecture 17, page 1 Protection The OS must allow users to control sharing of their files => control access to files Grant or

### Lecture 20: Dynamic Memory Allocation Advanced

CSCI-UA.0201-003 Computer Systems Organization Lecture 20: Dynamic Memory Allocation Advanced Slides adapted (and slightly modified) from: Clark Barrett Jinyang Li Randy Bryant Dave O Hallaron Mohamed

### Dynamic arrays and linked lists

Unit 11 Dynamic arrays and linked lists Summary Limitations of arrays Dynamic memory management Definitions of lists Tyical oerations on lists: iterative imlementation Tyical oerations on lists: recursive

### Memory Management Basics

Memory Management Basics 1 Basic Memory Management Concepts Address spaces Physical address space The address space supported by the hardware Starting at address, going to address MAX sys Logical/virtual

### Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need

### Memory Management. Today. Next Time. ! Basic memory management! Swapping! Kernel memory allocation. ! Virtual memory

Memory Management Today! Basic memory management! Swapping! Kernel memory allocation Next Time! Virtual memory Memory management! Ideal memory for a programmer Large Fast Non volatile Cheap! Nothing like

### CSE 380 Computer Operating Systems. Instructor: Insup Lee. University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.

CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management 1 Memory Management q The memory management portion of the Operating System

### Goals of memory management. Today s desktop and server systems. Tools of memory management. A trip down Memory Lane

Goals of memory management CSE 451: Operating Systems Spring 212 Module 11 Memory Management Allocate memory resources among competing processes, maximizing memory utilization and system throughput Provide

### Contiguous Allocation (Cont.)

// CS: Oerating System Lect 9: 5 th Oct Dr. A. Sahu Det of Com. Sc. & Engg. Inian Institute of Technology Guwahati ain emory an emory anagement Relocation & ultile Partition Contiguous Allocation Best

### Section I Section Real Time Systems. Processes. 1.7 Memory Management. (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction

EE206: Software Engineering IV 1.7 Memory Management page 1 of 28 Section I Section Real Time Systems. Processes 1.7 Memory Management (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction

### Memory management. The memory manager. Explicit deallocation. Advanced Compiler Construction Michel Schinz

Memory management Memory management Advanced Compiler Construction Michel Schinz 2014 04 10 The memory of a computer is a finite resource. Typical programs use a lot of memory over their lifetime, but

### Last Class: Demand Paged Virtual Memory!

Last Class: Demand Paged Virtual Memory! Benefits of demand paging: Virtual address space can be larger than physical address space. Processes can run without being fully loaded into memory. Processes

### Memory management challenges

Virtual Page 1 Memory management challenges Wednesday, October 27, 2004 7:59 AM Memory management challenges Fragmentation: memory is broken up into segments with gaps between them; must find a "fragment"

### 406 memory pool memory allocation handle memory deallocation dynamic storage allocation

406 Chap. 12 Lists and Arrays Revisited 12.4 Memory Management Most of the data structure implementations described in this book store and access objects all of the same size, such as integers stored in

### CS420: Operating Systems

Virtual Memory James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Code needs

### Ecient Programming in C

Ecient Programming in C Memory Allocation Comparison and implementation of basic malloc algorithms Marcel Ellermann(6315155) DKRZ - Deutsches Klima Rechenzentrum Contents Ecient Programming in C........................................

### 4 Main Memory Management

4 Main Memory Management 4.1 Introduction A large part of the OS s responsibility is organising main memory for processes. GOAL pack as many processes into memory as possible so that the processor will

### Overview. Manually: e.g. using free Automatically: e.g. using a garbage collector. Compilers Memory Management CSE 304/504 1 / 16.

Overview Memory Management Stack: Data on stack (local variables on activation records) have lifetime that coincides with the life of a procedure call. Memory for stack data is allocated on entry to procedures......

### William Stallings Computer Organization and Architecture

William Stallings Computer Organization and Architecture Chapter 8 Operating System Support Rev. 3.2 (2009-10) by Enrico Nardelli 8-1 Objectives and Functions Convenience Making the computer easier to

### Mass-Storage Devices: Disks. CSCI 5103 Operating Systems. Basic Disk Functionality. Magnetic Disks

Mass-Storage Devices: Disks CSCI 5103 Operating Systems Instructor: Abhishek Chandra Disk Structure and Attachment Disk Scheduling Disk Management RAID Structure Stable Storage 2 Magnetic Disks Most common

### Last Class: Memory Management. Recap: Paging

Last Class: Memory Management Static & Dynamic Relocation Fragmentation Paging Lecture 12, page 1 Recap: Paging Processes typically do not use their entire space in memory all the time. Paging 1. divides

### File Systems: Fundamentals

Files What is a file? A named collection of related information recorded on secondary storage (e.g., disks) File Systems: Fundamentals File attributes Name, type, location, size, protection, creator, creation

### C-Bus Voltage Calculation

D E S I G N E R N O T E S C-Bus Voltage Calculation Designer note number: 3-12-1256 Designer: Darren Snodgrass Contact Person: Darren Snodgrass Aroved: Date: Synosis: The guidelines used by installers

### COSC243 Part 2: Operating Systems

COSC243 Part 2: Operating Systems Lecture 20: Main Memory Management Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 20 1 / 29 O/S/ course overview Introduction

### Point Location. Preprocess a planar, polygonal subdivision for point location queries. p = (18, 11)

Point Location Prerocess a lanar, olygonal subdivision for oint location ueries. = (18, 11) Inut is a subdivision S of comlexity n, say, number of edges. uild a data structure on S so that for a uery oint

### PROJECT REPORT MEMORY MANAGEMENT DATE :

PROJECT REPORT MEMORY MANAGEMENT DATE : GROUP MEMBERS: MEMORY MANAGEMENT PURPOSE: To simulate memory management of a simple system in order to better comprehend the complex memory management system of

### Objectives and Functions

Objectives and Functions William Stallings Computer Organization and Architecture 6 th Edition Week 10 Operating System Support Convenience Making the computer easier to use Efficiency Allowing better

### CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 34: Memory Management 16 Apr 08

CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 34: Memory Management 16 Apr 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Outline Explicit memory management Garbage collection techniques

### 3. Memory Management

Principles of Operating Systems CS 446/646 3. Memory Management René Doursat Department of Computer Science & Engineering University of Nevada, Reno Spring 2006 Principles of Operating Systems CS 446/646

### Linux Memory Management

Lecture Overview Linux memory management This part of the Linux kernel is relatively complex and is only presented in overview, the point is to familiarize yourself with the names and terminology Paging

### Memory Management. Main memory Virtual memory

Memory Management Main memory Virtual memory Main memory Background (1) Processes need to share memory Instruction execution cycle leads to a stream of memory addresses Basic hardware CPU can only access

### Free-Space Management

17 Free-Space Management In this chapter, we take a small detour from our discussion of virtualizing memory to discuss a fundamental aspect of any memory management system, whether it be a malloc library

### Chapter 9: Virtual-Memory Management

Chapter 9: Virtual-Memory Management Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocation Kernel Memory Other

### An Efficient Method for Improving Backfill Job Scheduling Algorithm in Cluster Computing Systems

The International ournal of Soft Comuting and Software Engineering [SCSE], Vol., No., Secial Issue: The Proceeding of International Conference on Soft Comuting and Software Engineering 0 [SCSE ], San Francisco

### memory management Vaibhav Bajpai

memory management Vaibhav Bajpai OS 2014 motivation virtualize resources: multiplex CPU multiplex memory (CPU scheduling) (memory management) why manage memory? controlled overlap processes should NOT

### Synopsys RURAL ELECTRICATION PLANNING SOFTWARE (LAPER) Rainer Fronius Marc Gratton Electricité de France Research and Development FRANCE

RURAL ELECTRICATION PLANNING SOFTWARE (LAPER) Rainer Fronius Marc Gratton Electricité de France Research and Develoment FRANCE Synosys There is no doubt left about the benefit of electrication and subsequently

### International Journal Of Engineering Research & Management Technology

International Journal Of Engineering Research & Management Technology ISSN: 2348-4039 September- 2014 Volume 1, Issue-5 Dynamic Implementation Using Linked List Karuna Department of Information and Technology

### Node-Based Structures Linked Lists: Implementation

Linked Lists: Implementation CS 311 Data Structures and Algorithms Lecture Slides Monday, March 30, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org

### Last Time: Dynamic Memory Allocation. Introduction to Computer Systems /18 243, fall th Lecture, Oct. 27 th. Last Time: Fragmentation

Last Time: Dynamic Memory Allocation Introduction to Computer Systems 15 213/18 243, fall 2009 17 th Lecture, Oct. 27 th p1 = malloc(4) p2 = malloc(5) p3 = malloc(6) Instructors: Roger Dannenberg and Greg

### Main Memory. Memory. Address binding. Memory spaces. All processes need main memory.

Memory If we define memory as a place where data is stored there are many levels of memory: Processor registers Primary (or main) memory RAM Secondary memory slower and more permanent disks Tertiary memory

### Operating Systems File Systems II

CSCI-GA.2250-001 Operating Systems File Systems II Hubertus Franke frankeh@cs.nyu.edu Abstracted by OS as files A Conventional Hard Disk (Magnetic) Structure Hard Disk (Magnetic) Architecture Surface

### Up until now we assumed that an entire program/process needed to be in memory to execute

Lecture Overview Virtual memory Demand paging Page faults Page replacement Frame allocation Thrashing Operating Systems - June 7, 00 Virtual Memory Up until now we assumed that an entire program/process

### Improved Symmetric Lists

Imroved Symmetric Lists Technical Reort MIP-49 October, 24 Christian Bachmaier and Marcus Raitner University of Passau, 943 Passau, Germany Fax: +49 85 59 332 {bachmaier,raitner}@fmi.uni-assau.de Abstract.

### System Software Prof. Dr. H. Mössenböck

System Software Prof. Dr. H. Mössenböck 1. Memory Management 2. Garbage Collection 3. Linkers and Loaders 4. Debuggers 5. Text Editors Marks obtained by end-term exam http://ssw.jku.at/misc/ssw/ 1. Memory

### Operating Systems Lecture #2b: Early Paradigms of Memory Management II

Lecture #2b: Early Paradigms of Memory Management II Written by based on the lecture series of Dr. Dayou Li and the book Understanding 4th ed. by I.M.Flynn and A.McIver McHoes (2006) Department of Computer

### Goals 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

### Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Chapter 8: Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation

### ICS Principles of Operating Systems

ICS 143 - Principles of Operating Systems Operating Systems - Review of content from midterm to final Prof. Ardalan Amiri Sani Prof. Nalini Venkatasubramanian ardalan@uci.edu nalini@ics.uci.edu Deadlocks

### Problem Set 6 Solutions

( Introduction to Algorithms Aril 16, 2004 Massachusetts Institute of Technology 6046J/18410J Professors Erik Demaine and Shafi Goldwasser Handout 21 Problem Set 6 Solutions This roblem set is due in recitation

### Assignment 9; Due Friday, March 17

Assignment 9; Due Friday, March 17 24.4b: A icture of this set is shown below. Note that the set only contains oints on the lines; internal oints are missing. Below are choices for U and V. Notice that

### Virtual 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

### Part III Storage Management. Chapter 11: File System Implementation

Part III Storage Management Chapter 11: File System Implementation 1 Layered File System 2 Overview: 1/4 A file system has on-disk and in-memory information. A disk may contain the following for implementing

### Virtual Memory. Virtual Memory

Virtual Memory Gordon College Stephen Brinton Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Demand Segmentation Operating System Examples Background

### Memory management in C: The heap and the stack

Memory management in C: The heap and the stack Leo Ferres Department of Computer Science Universidad de Concepción leo@inf.udec.cl October 7, 2010 1 Introduction When a program is loaded into memory, it

### Lecture 10: Memory Management

Lecture 10: Memory Management CSE 120: Principles of Operating Systems guest starring Amin Vahdat Project 2 Due 11/14 Memory Management Next few lectures are going to cover memory management Goals of memory

### Embedded RTOS Memory Management

CS512 Embedded RTOS Embedded RTOS Memory Management C.-Z. Yang http://syslab.cse.yzu.edu.tw/~czyang Background Program must be brought into memory and placed within a process for it to be run. Binding

### Learning Outcomes. Memory Management

Learning Outcomes Memory Management Appreciate the need for memory management in operating systems, understand the limits of fixed memory allocation schemes. Understand fragmentation in dynamic memory

### Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Demand Segmentation Operating System Examples 9.2 Background

### & Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Folie a: Name & Data Processing 2 3: Memory Management Dipl.-Ing. Bogdan Marin Fakultät für Ingenieurwissenschaften Abteilung Elektro-und Informationstechnik -Technische Informatik- Objectives Memory Management

### Administrivia. - As before, free extension if you are here. - Open book, open notes (but not open notebook computer)

p. 1/3 Administrivia Project 2 due right now - As before, free extension if you are here Midterm Tuesday - Open book, open notes (but not open notebook computer) Review section for midterm this tomorrow

### Module 10: Virtual Memory

Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmenation Applied

### Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

Advanced C Programming Memory Management II (malloc, free, alloca, obstacks, garbage collection) Sebastian Hack hack@cs.uni-sb.de Christoph Weidenbach weidenbach@mpi-inf.mpg.de 16.12.2008 saarland university

### The Optimal Sequenced Route Query

The Otimal Sequenced Route Query Mehdi Sharifzadeh, Mohammad Kolahdouzan, Cyrus Shahabi Comuter Science Deartment University of Southern California Los Angeles, CA 90089-0781 [sharifza, kolahdoz, shahabi]@usc.edu

### Dynamic Memory Management in Hardware

Dynamic Memory Management in Hardware A master thesis presented to the Mälardalens University in fulfilment of the thesis requirement for the degree of Master of Science in Electrical Engineering Västerås,

### c 2009 Je rey A. Miron 3. Examples: Linear Demand Curves and Monopoly

Lecture 0: Monooly. c 009 Je rey A. Miron Outline. Introduction. Maximizing Pro ts. Examles: Linear Demand Curves and Monooly. The Ine ciency of Monooly. The Deadweight Loss of Monooly. Price Discrimination.

### Paging: Design Issues

Paging: Design Issues 1! 2! Readings Silbershatz et al: 9.5-9.6 3! Outline Frame Allocation Case Studies 4! Thrashing A process causing page faults every few instructions is said to be thrashing If a process

### Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Overview. Faloutsos CMU SCS

Faloutsos 15-415 Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications Lecture #8 (R&G ch9) Storing Data: Disks and Files Faloutsos 15-415 #1 Overview Memory hierarchy RAID (briefly)

### COSC 6374 Parallel Computation. Parallel I/O (I) I/O basics. Concept of a clusters

COSC 6374 Parallel I/O (I) I/O basics Fall 2012 Concept of a clusters Processor 1 local disks Compute node message passing network administrative network Memory Processor 2 Network card 1 Network card

### lecture 25: Gaussian quadrature: nodes, weights; examples; extensions

38 lecture 25: Gaussian quadrature: nodes, weights; examles; extensions 3.5 Comuting Gaussian quadrature nodes and weights When first aroaching Gaussian quadrature, the comlicated characterization of the

### Math 5330 Spring Notes Prime Numbers

Math 5330 Sring 206 Notes Prime Numbers The study of rime numbers is as old as mathematics itself. This set of notes has a bunch of facts about rimes, or related to rimes. Much of this stuff is old dating

### Chapter 2 Memory Management: Early Systems. Understanding Operating Systems, Fourth Edition

Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition Memory Management: Early Systems Memory is second only to processes in importance (and in intensity) with which

### LOGICAL AND PHYSICAL ORGANIZATION MEMORY MANAGEMENT TECHNIQUES (CONT D)

MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

### Chapter 9: Virtual-Memory Management

Chapter 9: Virtual-Memory Management Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocation Kernel Memory Other

### 10/24/16. Journey of Byte. BBM 371 Data Management. Disk Space Management. Buffer Management. All Data Pages must be in memory in order to be accessed

Journey of Byte BBM 371 Management Lecture 4: Basic Concepts of DBMS 25.10.2016 Application byte/ record File management page, page num Buffer management physical adr. block Disk management Request a record/byte

### Silberschatz and Galvin Chapter 9

Silberschatz and Galvin Chapter 9 Virtual Memory CPSC Richard Furuta /6/99 Virtual memory Virtual memory permits the execution of processes that are not entirely in physical memory Programmer benefits

### Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

### Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

CHAPTER 8 Although many systems are demand paged (discussed in Chapter 12), there are still many that are not, and in many cases the simpler memory-management strategies may be better, especially for small

### Chapter 6: CPU Scheduling. Basic Concepts

Chater 6: CPU Scheduling Basic Concets Scheduling Criteria Scheduling Algorithms Multile-Processor Scheduling Real-Time Scheduling Thread Scheduling Oerating Systems Examles Java Thread Scheduling Algorithm

### CPSC 410/611: Disk Management

CPSC 41/611: Disk Management Disk Structure Disk Scheduling RAID Disk Block Management Reading: Silberschatz Chapter 12 cylinder Disk Structure sector track Disk speed: seek time : rotational delay : transfer

### Storage in Database Systems. CMPSCI 445 Fall 2010

Storage in Database Systems CMPSCI 445 Fall 2010 1 Storage Topics Architecture and Overview Disks Buffer management Files of records 2 DBMS Architecture Query Parser Query Rewriter Query Optimizer Query

### W4118: file systems. Instructor: Junfeng Yang

W4118: file systems Instructor: Junfeng Yang References: Modern Operating Systems (3 rd edition), Operating Systems Concepts (8 th edition), previous W4118, and OS at MIT, Stanford, and UWisc Outline File

### Memory Hierarchy. Goals of Today s Lecture. Professor Jennifer Rexford Memory hierarchy. Locality of reference

Memory Hierarchy Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex Goals of Today s Lecture Memory hierarchy o From fast/expensive/small to slow/cheap/big memory technology o Registers, on-chip

Chapter 7 Linked Lists In order to use linked lists, you need to learn how to allocate memory dynamically on the heap and you need to learn about objects. Recall that local variables are temporary which

### Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) (Review) Memory Management

Outline V22.0202-001 Computer Systems Organization II (Honors) (Introductory Operating Systems) Lecture 14 Memory Management March 28, 2005 Announcements Lab 4 due next Monday (April 4 th ) demos on 4