Fast Allocation and Deallocation with an Improved Buddy System

  • Erik D. Demaine
  • Ian J. Munro
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1738)


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 Θ(lg n) time in the worst case (and on an amortized basis), where n is the size of the memory. We present two schemes that improve the running time to O(1) time, where the time bound for deallocation is amortized. The first scheme uses one word of extra storage compared to the standard buddy system, but may fragment memory more than necessary. The second scheme has essentially the same fragmentation as the standard buddy system, and uses \( O(2^{(1 + \sqrt {\lg n} )\lg \lg n} )\) bits of auxiliary storage, which is ω(lgk n) but o(n ε) for all k ≥ 1 and ε > 0. Finally, we present simulation results estimating the effect of the excess fragmentation in the first scheme.


Block Size Large Block Free List Free Block Extra Storage 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    R. E. Barkley and T. Paul Lee. A lazy buddy system bounded by two coalescing delays per class. Operating Systems Review, pages 167–176, Dec. 1989. 95Google Scholar
  2. 2.
    Andrej Brodnik. Computation of the least significant set bit. In Proceedings of the 2nd Electrotechnical and Computer Science Conference, Portoroz, Slovenia, 1993. 90Google Scholar
  3. 3.
    Allan G. Bromley. An improved buddy method for dynamic storage allocation. In Proceedings of the 7th Australian Computer Conference, pages 708–715, 1976. 86Google Scholar
  4. 4.
    Allan G. Bromley. Memory fragmentation in buddy methods for dynamic storage allocation. Acta Informatica, 14:107–117, 1980. 86, 86CrossRefGoogle Scholar
  5. 5.
    Warren Burton. A buddy system variation for disk storage allocation. Communications of the ACM, 19(7):416–417, July 1976. 86CrossRefMathSciNetGoogle Scholar
  6. 6.
    Shyamal K. Chowdhury and Pradip K. Srimani. Worst case performance of weighted buddy systems. Acta Informatica, 24(5):555–564, 1987. 86zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Ben Cranston and Rick Thomas. A simplified recombination scheme for the Fibonacci buddy system. Communications of the ACM, 18(6):331–332, June 1975. 86CrossRefGoogle Scholar
  8. 8.
    James A. Hinds. Algorithm for locating adjacent storage blocks in the buddy system. Communications of the ACM, 18(4):221–222, Apr. 1975. 86CrossRefGoogle Scholar
  9. 9.
    Daniel S. Hirschberg. A class of dynamic memory allocation algorithms. Communications of the ACM, 16(10):615–618, Oct. 1973. 86zbMATHCrossRefGoogle Scholar
  10. 10.
    Arie Kaufman. Tailored-list and recombination-delaying buddy systems. ACM Transactions on Programming Languages and Systems, 6(1):118–125, Jan. 1984. 95CrossRefGoogle Scholar
  11. 11.
    Kenneth C. Knowlton. A fast storage allocator. Communications of the ACM, 8(10):623–625, Oct. 1965. 85zbMATHCrossRefGoogle Scholar
  12. 12.
    Kenneth C. Knowlton. A programmer’s description of L6. Communications of the ACM, 9(8):616–625, Aug. 1966. 85CrossRefGoogle Scholar
  13. 13.
    Donald E. Knuth. Dynamic storage allocation. In The Art of Computer Programming, volume 1, section 2.5, pages 435–455. Addison-Wesley, 1968. 84, 85, 86, 92MathSciNetGoogle Scholar
  14. 14.
    Philip D. L. Koch. Disk file allocation based on the buddy system. ACM Transactions on Computer Systems, 5(4):352–370, Nov. 1987. 86CrossRefGoogle Scholar
  15. 15.
    T. Paul Lee and R. E. Barkley. Design and evaluation of a watermark-based lazy buddy system. Performance Evaluation Review, 17(1):230, May 1989. 95Google Scholar
  16. 16.
    T. Paul Lee and R. E. Barkley. A watermark-based lazy buddy system for kernel memory allocation. In Proceedings of the 1989 Summer USENIX Conference, pages 1–13, June 1989. 95Google Scholar
  17. 17.
    Errol L. Lloyd and Michael C. Loui. On the worst case performance of buddy systems. Acta Informatica, 22(4):451–473, 1985. 86zbMATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Marshall Kirk McKusick, Keith Bostic, Michael J. Karels, and John S. Quarterman. The Design and Implementation of the 4.4 BSD Operating System. Addison-Wesley, 1996. 85, 88, 94Google Scholar
  19. 19.
    Ivor P. Page and Jeff Hagins. Improving the performance of buddy systems. IEEE Transactions on Computers, C-35(5):441–447, May 1986. 86CrossRefGoogle Scholar
  20. 20.
    James L. Peterson and Theodore A. Norman. Buddy systems. Communications of the ACM, 20(6):421–431, June 1977. 86, 86zbMATHCrossRefGoogle Scholar
  21. 21.
    Paul W. Purdom, Jr. and Stephen M. Stigler. Statistical properties of the buddy system. Journal of the ACM, 17(4):683–697, Oct. 1970. 86zbMATHCrossRefGoogle Scholar
  22. 22.
    David L. Russell. Internal fragmentation in a class of buddy systems. SIAM Journal on Computing, 6(4):607–621, Dec. 1977. 86, 86zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Kenneth K. Shen and James L. Peterson. A weighted buddy method for dynamic storage allocation. Communications of the ACM, 17(10):558–562, Oct. 1974. See also the corrigendum in 18(4):202, Apr. 1975. 86zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Erik D. Demaine
    • 1
  • Ian J. Munro
    • 1
  1. 1.Department of Computer ScienceUniversity of WaterlooWaterlooCanada

Personalised recommendations