Abstract.
We propose several modifications to the binary buddy system for managing dynamic allocation of memory blocks whose sizes are powers of two. The standard buddy system allocates and deallocates blocks in \(\Theta(\lg n)\) time in the worst case (and on an amortized basis), where n is the size of the memory. We present three schemes that improve the running time to O(1) time, where the time bound for deallocation is amortized for the first two schemes. The first scheme uses just one more word of memory than the standard buddy system, but may result in greater fragmentation than necessary. The second and third schemes have essentially the same fragmentation as the standard buddy system, and use \(O(2^{(1 + \sqrt{\lg n}) \lg \lg n})\) bits of auxiliary storage, which is \(\omega(\lg^k n)\) but \(o(n^\varepsilon)\) for all \(k \geq 1\) and \(\varepsilon > 0\). Finally, we present simulation results estimating the effect of the excess fragmentation in the first scheme.
Similar content being viewed by others
Explore related subjects
Discover the latest articles and news from researchers in related subjects, suggested using machine learning.References
Barkley, R.E., Lee, T.P. (1989) A lazy buddy system bounded by two coalescing delays per class. Operating Systems Review Dec.: 167-176
Brodnik, A. (1993) Computation of the least significant set bit. In: Proceedings of the 2nd Electrotechnical and Computer Science Conference, Portoroz, Slovenia
Bromley, A.G. (1976) An improved buddy method for dynamic storage allocation. In: Proceedings of the 7th Australian Computer Conference, pp. 708-715
Bromley, A.G. (1980) Memory fragmentation in buddy methods for dynamic storage allocation. Acta Informatica 14: 107-117
Burton, W. (1976) A buddy system variation for disk storage allocation. Communications of the ACM 19(7): 416-417
Chowdhury, S.K., Srimani, P.K.: Worst case performance of weighted buddy systems. Acta Informatica 24(5): 555-564
Cranston, B., Thomas, R. (1975) A simplified recombination scheme for the Fibonacci buddy system. Communications of the ACM 18(6): 331-332
Demaine, E.D., Munro, J.I. (1999) Fast Allocation and Deallocation with an Improved Buddy System. In: Proceedings of the 19th Conference on the Foundations of Software Technology and Theoretical Computer Science (FST & TCS’99), Lecture Notes in Computer Science, vol. 1738. Chennai, India, December 13-15, 1999, pp. 84-96
Hinds, J.A. (1975) Algorithm for locating adjacent storage blocks in the buddy system. Communications of the ACM 18(4): 221-222
Hirschberg, D.S. (1973) A class of dynamic memory allocation algorithms. Communications of the ACM 16(10): 615-618
Kaufman, A. (1984) Tailored-list and recombination-delaying buddy systems. ACM Transactions on Programming Languages and Systems 6(1): 118-125
Knowlton, K.C. (1965) A fast storage allocator. Communications of the ACM 8(10): 623-625
Knowlton, K.C. (1966) A programmer’s description of L6. Communications of the ACM 9(8): 616-625
Knuth, D.E. (1968) Dynamic storage allocation. In: The art of computer programming, vol. 1, Sect. 2.5, pp. 435-455. Addison-Wesley
Koch, P.D.L. (1987) Disk file allocation based on the buddy system. ACM Transactions on Computer Systems 5(4): 352-370
Lee, T.P., Barkley, R.E. (1989) Design and evaluation of a watermark-based lazy buddy system. Performance Evaluation Review 17(1): 230
Lee, T.P., Barkley, R.E. (1989) A watermark-based lazy buddy system for kernel memory allocation. In: Proceedings of the 1989 Summer USENIX Conference, June, pp. 1-13
Lloyd, E.L., Loui, M.C. (1985) On the worst case performance of buddy systems. Acta Informatica 22(4): 451-473
McKusick, M.K., Bostic, K., Karels, M.J., Quarterman, J.S. (1996) The design and implementation of the 4.4 BSD operating system. Addison-Wesley
Page, I.P., Hagins, J. (1986) Improving the performance of buddy systems. IEEE Transactions on Computers C-35(5): 441-447
Peterson, J.L., Norman, T.A. (1977) Buddy systems. Communications of the ACM 20(6): 421-431
Purdom, P.W. Jr., Stigler, S.M. (1970) Statistical properties of the buddy system. Journal of the ACM 17(4): 683-697
Russell, D.L. (1977) Internal fragmentation in a class of buddy systems. SIAM Journal on Computing 6(4): 607-621
Shen, K.K., Peterson, J.L. (1974) A weighted buddy method for dynamic storage allocation. Communications of the ACM 17(10): 558-562. See also the corrigendum in 18(4): 202 (Apr. 1975)
Author information
Authors and Affiliations
Corresponding author
Additional information
Received: 4 May 2003, Published online: 22 December 2004
Gerth Stølting Brodal: Supported by the Carlsberg Foundation (contract number ANS-0257/20). Partially supported by the Future and Emerging Technologies Programme of the EU under contract number IST-1999-14186 (ALCOM-FT). Basic Research in Computer Science, www.brics.dk, funded by the Danish National Research Foundation.
Erik D. Demaine: Partially supported by the Natural Science and Engineering Research Council of Canada (NSERC).
J. Ian Munro: Supported by the Natural Science and Engineering Research Council of Canada (NSERC) and the Canada Research Chair in Algorithm Design.
This paper includes several results that appeared in preliminary form in the Proceedings of the 19th Conference on the Foundations of Software Technology and Theoretical Computer Science (FST & TCS’99) [8].
Rights and permissions
About this article
Cite this article
Brodal, G.S., Demaine, E.D. & Munro, J.I. Fast allocation and deallocation with an improved buddy system. Acta Informatica 41, 273–291 (2005). https://doi.org/10.1007/s00236-004-0159-6
Issue Date:
DOI: https://doi.org/10.1007/s00236-004-0159-6