5/23/20151 GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques.

Slides:



Advertisements
Similar presentations
Comp 335 File Structures Reclaiming and Reusing File Space Techniques for File Maintenance.
Advertisements

Hash-based Indexes CS 186, Spring 2006 Lecture 7 R &G Chapter 11 HASH, x. There is no definition for this word -- nobody knows what hash is. Ambrose Bierce,
1 Hash-Based Indexes Module 4, Lecture 3. 2 Introduction As for any index, 3 alternatives for data entries k* : – Data record with key value k – –Choice.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Hash-Based Indexes Chapter 11.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree.
1 Smart Memory for Smart Phones Chris Clack University College London
Fixed/Variable Partitioning
Allocating Memory.
Lab 3: Malloc Lab. “What do we need to do?”  Due 11/26  One more assignment after this one  Partnering  Non-Honors students may work with one other.
OS Fall’02 Memory Management Operating Systems Fall 2002.
1 1 Lecture 4 Structure – Array, Records and Alignment Memory- How to allocate memory to speed up operation Structure – Array, Records and Alignment Memory-
Dynamic memory allocation and fragmentation Seminar on Network and Operating Systems Group II.
Memory Management Memory Areas and their use Memory Manager Tasks:
1 Hash-Based Indexes Chapter Introduction  Hash-based indexes are best for equality selections. Cannot support range searches.  Static and dynamic.
FALL 2004CENG 3511 Hashing Reference: Chapters: 11,12.
Memory Management A memory manager should take care of allocating memory when needed by programs release memory that is no longer used to the heap. Memory.
1 Hash-Based Indexes Chapter Introduction : Hash-based Indexes  Best for equality selections.  Cannot support range searches.  Static and dynamic.
Chapter 5: Memory Management Dhamdhere: Operating Systems— A Concept-Based Approach Slide No: 1 Copyright ©2005 Memory Management Chapter 5.
Memory Management Five Requirements for Memory Management to satisfy: –Relocation Users generally don’t know where they will be placed in main memory May.
E.G.M. PetrakisHashing1 Hashing on the Disk  Keys are stored in “disk pages” (“buckets”)  several records fit within one page  Retrieval:  find address.
Data Structures Using C++ 2E Chapter 9 Searching and Hashing Algorithms.
Chapter 2 Memory Management: Early Systems (all ancient history)
Memory Allocation CS Introduction to Operating Systems.
Dynamic Memory Allocation Questions answered in this lecture: When is a stack appropriate? When is a heap? What are best-fit, first-fit, worst-fit, and.
CS 11 C track: lecture 5 Last week: pointers This week: Pointer arithmetic Arrays and pointers Dynamic memory allocation The stack and the heap.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture8.
Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition.
Programming III SPRING 2015 School of Computer and Information Sciences Francisco R. Ortega, Ph.D. McKnight Fellow and GAANN Fellow LECTURE #6C Pointers,
Hashing and Hash-Based Index. Selection Queries Yes! Hashing  static hashing  dynamic hashing B+-tree is perfect, but.... to answer a selection query.
Memory Management II: Dynamic Storage Allocation Mar 7, 2000 Topics Segregated free lists –Buddy system Garbage collection –Mark and Sweep –Copying –Reference.
1 Advanced Memory Management Techniques  static vs. dynamic kernel memory allocation  resource map allocation  power-of-two free list allocation  buddy.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture17.
HASHING PROJECT 1. SEARCHING DATA STRUCTURES Consider a set of data with N data items stored in some data structure We must be able to insert, delete.
Writing You Own malloc() March 29, 2003 Topics Explicit Allocation Data structures Mechanisms Policies class19.ppt “The course that gives CMU its.
CS 241 Discussion Section (11/17/2011). Outline Review of MP7 MP8 Overview Simple Code Examples (Bad before the Good) Theory behind MP8.
1.1 CS220 Database Systems Indexing: Hashing Slides courtesy G. Kollios Boston University via UC Berkeley.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Indexed Sequential Access Method.
Hash Table March COP 3502, UCF 1. Outline Hash Table: – Motivation – Direct Access Table – Hash Table Solutions for Collision Problem: – Open.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
Memory Management -Memory allocation -Garbage collection.
Chapter 15 A External Methods. © 2004 Pearson Addison-Wesley. All rights reserved 15 A-2 A Look At External Storage External storage –Exists beyond the.
Dynamic Memory Allocation II
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module D: Hashing.
University of Washington Today More memory allocation!
CS 241 Discussion Section (2/9/2012). MP2 continued Implement malloc, free, calloc and realloc Reuse free memory – Sequential fit – Segregated fit.
CS 241 Discussion Section (12/1/2011). Tradeoffs When do you: – Expand Increase total memory usage – Split Make smaller chunks (avoid internal fragmentation)
1 Dynamic Memory Allocation (II) Implementation. 2 Outline Implementation of a simple allocator Explicit Free List Segregated Free List Suggested reading:
Carnegie Mellon 1 Malloc Lab : Introduction to Computer Systems Friday, July 10, 2015 Shen Chen Xu.
University of Washington Implementation Issues How do we know how much memory to free given just a pointer? How do we keep track of the free blocks? How.
Chapter 5 Record Storage and Primary File Organizations
© 2006 Pearson Addison-Wesley. All rights reserved15 A-1 Chapter 15 External Methods.
External fragmentation in a paging system Use paging circuitry to map groups of noncontiguous free pages into logically contiguous addresses (remap your.
LINKED LISTS.
Dynamic Memory Allocation II
Section 10: Memory Allocation Topics
Memory Management Memory Areas and their use Memory Manager Tasks:
Dynamic memory allocation and fragmentation
Partitioned Memory Allocation
Memory Management Memory Areas and their use Memory Manager Tasks:
Hashing CENG 351.
Lecture 26: Memory Management - Swapping
Introduction to Database Systems
Data Structures and Algorithms
Memory Allocation II CSE 351 Autumn 2017
Chapter 12 Memory Management
Hash-Based Indexes Chapter 11
Memory Management Memory Areas and their use Memory Manager Tasks:
CS703 - Advanced Operating Systems
Lecture 26: Memory Management - Swapping
Presentation transcript:

5/23/20151 GC16/3011 Functional Programming Lecture 19 Memory Allocation Techniques

5/23/20152 Contents  Pointer increment  Free list – sequential fits  Segregated free lists  Buddy systems

5/23/20153 Pointer increment  Ideal world:  all allocated memory would be at one end  All free memory at other end  Single pointer to boundary  To allocate a block of size N, increment the boundary pointer by N and return the original value of the boundary pointer  Problems: to achieve an “ideal world” may be costly

5/23/20154 Free list: sequential fits  Assume all free blocks chained together into a linked list.  A pointer holds the start of this chain  Freed blocks either added to start (LIFO) or end (FIFO) of chain, or inserted into chain in order of address (AO)  First fit allocation  Larger blocks near start of list tend to be split first, resulting in many small fragments at start of list  Next fit allocation  Tends to increase fragmentation in practice  Best fit allocation  Tiny fragments? Not in practice.  Slow? Not always.

5/23/20155 Segregated free lists  Set of free lists  each for blocks of a specific size  or for a range of sizes  Use first-fit or next-fit etc within free list  “Good fit”  Or even “worst fit”  Use an array of pointers to the free lists  Or a tree of pointers to the free lists

5/23/20156 Buddy systems  Variant of segregated free lists  Aimed to optimize splitting and coalescing  A free area may only be merged with its buddy  When block freed - (unique) buddy found by simple address arithmetic  wholly in use, or wholly free (so can merge)  Binary buddies  problem with internal frags (25%)  Double buddies  uses powers-of-two (2, 4, 8…) AND double-from-three (3, 6, 12…)  Better frags (12.5%) but restricted coalescing

5/23/20157 Summary  Pointer increment  Free list – sequential fits  Segregated free lists  Buddy systems