Home
Add Document
Sign In
Create An Account
W4118: dynamic memory allocation
W4118: dynamic memory allocation Instructor: Junfeng Yang References: Modern Operating Systems (3rd edition), Operating Systems Concepts (8th editio...
Author:
Phoebe Merritt
0 downloads
0 Views
178KB Size
Report
Download PDF
Recommend Documents
Dynamic Memory Allocation
Dynamic Memory Allocation
Dynamic memory allocation in C
Memory Allocation. Memory Allocation. Memory. Memory
Dynamic Memory Allocation in C++ An Introduction
W4118: Linux memory management
Dynamic Memory Allocation. Spring 2012 Programming and Data Structure 1
9.5 Memory Allocation Techniques
Memory Allocation Schemes
CSCI 104 Memory Allocation
Dynamic Processing Allocation in Video
Dynamic Mean-Variance Asset Allocation
Virtual Memory. Today. Next time. Motivations for VM Address translation Accelerating translation with TLBs. Dynamic memory allocation and memory bugs
Dynamic Allocation. Carbon Expo Frederic DINGUIRARD
Verkaufsprospekt M&G Dynamic Allocation Fund
MANAGE PORTFOLIO VOLATILITY THROUGH DYNAMIC ASSET ALLOCATION
Double Auctions for Dynamic Spectrum Allocation
CpSc 1011 Lab 13 Command-Line Arguments, Structs, & Dynamic Memory Allocation
Model Predictive Control for Dynamic Resource Allocation
O dynamic memory (malloc and free)
W4118: Linux file systems
Dynamic resource allocation and management in virtual networks and Clouds
Dynamic Resource Allocation using Virtual Machines for Cloud Computing
Heap Data Allocation to Scratch-Pad Memory in Embedded Systems
W4118: dynamic memory allocation
Instructor: Junfeng Yang
References: Modern Operating Systems (3rd edition), Operating Systems Concepts (8th edition), previous W4118, and OS at MIT, Stanford, and UWisc
Outline
Dynamic memory allocation overview
Heap allocation strategies
Memory management review
Copy-on-write
1
Dynamic memory allocation
Static (compile time) allocation is not possible for all data Two ways of dynamic allocation
Stack allocation • Restricted, but simple and efficient
Heap allocation • More general, but less efficient • More difficult to implement
2
Dynamic allocation issue: fragmentation
Fragment: small trunks of free memory, too small for future allocation requests “holes”
Goal
External fragment: visible to system Internal fragment: visible to process (e.g. if allocate at some granularity)
Reduce number of holes Keep holes large
Stack fragmentation v.s. heap fragmentation
3
Typical heap implementation
Data structure: free list
Allocation
Chains free blocks together
Choose block large enough for request Update free list
Free
Add block back to list Merge adjacent free blocks
4
Heap allocation strategies
Best fit
First fit
Search the whole list on each allocation Choose the smallest block that can satisfy request Can stop search if exact match found
Choose first block that can satisfy request
Worst fit
Choose largest block (most leftover space)
Which is better? 5
Example
Free space: 2 blocks, size 20 and 15 Workload 1: allocation requests: 10 then 20 Best fit
First fit
Request of 20: fail!
Worse fit
Request of 20: fail!
Workload 2: allocation requests: 8, 12, then 13 Best fit
Request of 13: fail!
First fit Worse fit
Request of 13: fail! 6
Comparison of allocation strategies
Best fit
First fit:
Tends to leave very large holes and very small holes Disadvantage: very small holes may be useless
Tends to leave “average” size holes Advantage: faster than best fit
Worst fit:
Simulation shows that worst fit is worst in terms of storage utilization
7
Buddy allocator motivation
Allocation requests: frequently 2^n
E.g., allocation physical pages in Linux Generic allocation strategies: overly generic
Fast search (allocate) and merge (free)
Avoid iterating through free list
Avoid external fragmentation for req of 2^n
Keep physical pages contiguous Real: used in FreeBSD and Linux 8
Buddy allocator implementation
Data structure
N free lists of blocks of size 2^0, 2^1, …, 2^N
Allocation restrictions: 2^k, 0
Suggest Documents
Dynamic Memory Allocation
Read more
Dynamic Memory Allocation
Read more
Dynamic memory allocation in C
Read more
Memory Allocation. Memory Allocation. Memory. Memory
Read more
Dynamic Memory Allocation in C++ An Introduction
Read more
W4118: Linux memory management
Read more
Dynamic Memory Allocation. Spring 2012 Programming and Data Structure 1
Read more
9.5 Memory Allocation Techniques
Read more
Memory Allocation Schemes
Read more
CSCI 104 Memory Allocation
Read more
Dynamic Processing Allocation in Video
Read more
Dynamic Mean-Variance Asset Allocation
Read more
Virtual Memory. Today. Next time. Motivations for VM Address translation Accelerating translation with TLBs. Dynamic memory allocation and memory bugs
Read more
Dynamic Allocation. Carbon Expo Frederic DINGUIRARD
Read more
Verkaufsprospekt M&G Dynamic Allocation Fund
Read more
MANAGE PORTFOLIO VOLATILITY THROUGH DYNAMIC ASSET ALLOCATION
Read more
Double Auctions for Dynamic Spectrum Allocation
Read more
CpSc 1011 Lab 13 Command-Line Arguments, Structs, & Dynamic Memory Allocation
Read more
Model Predictive Control for Dynamic Resource Allocation
Read more
O dynamic memory (malloc and free)
Read more
W4118: Linux file systems
Read more
Dynamic resource allocation and management in virtual networks and Clouds
Read more
Dynamic Resource Allocation using Virtual Machines for Cloud Computing
Read more
Heap Data Allocation to Scratch-Pad Memory in Embedded Systems
Read more
×
Report "W4118: dynamic memory allocation"
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
×
Sign In
Email
Password
Remember me
Forgot password?
Sign In
Login with Google
Login with Facebook