Upper bound for defragmenting buddy heaps

Delvin C. Defoe, Sharath R. Cholleti, Ron K. Cytron
2005 SIGPLAN notices  
Knuth's buddy system is an attractive algorithm for managing storage allocation, and it can be made to operate in real-time. At some point, storage-management systems must either over-provide storage or else confront the issue of defragmentation. Because storage conservation is important to embedded systems, we investigate the issue of defragmentation for heaps that are managed by the buddy system. In this paper, we present tight bounds for the amount of storage necessary to avoid
more » ... n. These bounds turn out to be too high for embedded systems, so defragmentation becomes necessary. We then present an algorithm for defragmenting buddy heaps and present experiments from applying that algorithm to real and synthetic benchmarks. Our algorithm relocates less than twice the space relocated by an optimal algorithm to defragment the heap so as to respond to a single allocation request. Our experiments show our algorithm to be much more efficient than extant defragmentation algorithms.
doi:10.1145/1070891.1065942 fatcat:zogzh34rdvg2vh4ihgkkw3ym5q