Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

A constant-time dynamic storage allocator for real-time systems

Abstract

Dynamic memory allocation has been used for decades. However, it has seldom been used in real-time systems since the worst case of spatial and temporal requirements for allocation and deallocation operations is either unbounded or bounded but with a very large bound.

In this paper, a new allocator called TLSF (Two Level Segregated Fit) is presented. TLSF is designed and implemented to accommodate real-time constraints. The proposed allocator exhibits time-bounded behaviour, O(1), and maintains a very good execution time. This paper describes in detail the data structures and functions provided by TLSF. We also compare TLSF with a representative set of allocators regarding their temporal cost and fragmentation.

Although the paper is mainly focused on timing analysis, a brief study and comparative analysis of fragmentation incurred by the allocators has been also included in order to provide a global view of the behaviour of the allocators.

The temporal and spatial results showed that TLSF is also a fast allocator and produces a fragmentation close to that caused by the best existing allocators.

This is a preview of subscription content, log in to check access.

References

  1. Atienza D, Mamagkakis S, Leeman M, Catthoor F, Mendias JM, Soudris D, Deconinck G (2003) Fast system-level prototyping of power-aware dynamic memory managers for embedded systems. In: Workshop on compilers and operating systems for low power

  2. Berger ED, Zorn BG, McKinley KS (2002a) Reconsidering custom memory allocation. In: ACM conference on object-oriented programming, systems, languages, and applications, Seattle, WA, pp 1–12

  3. Berger ED, Zorn BG, McKinley KS (2002b) Reconsidering custom memory allocation. In: OOPSLA, pp 1–12

  4. Bollella G, Gosling J (2000) The real-time specification for Java. IEEE Comput 33(6):47–54

  5. Bonwick J (1994) The slab allocator: an object-caching Kernel memory allocator. In: USENIX summer, pp 87–98

  6. Feizabadi S, Ravindran B, Jensen ED (2005) MSA: a memory-aware utility accrual scheduling algorithm. In: SAC, pp 857–862

  7. OCERA, Open Components for Embedded Real-Time Applications (2002) IST 35102 European research project (http://www.ocera.org)

  8. Ford R (1996) Concurrent algorithms for real-time memory management. IEEE Softw 5(5):10–23

  9. Grunwald D, Zorn B (1993) CustoMalloc: efficient synthesized memory allocators. Softw Pract Exp 23(8):851–869

  10. Johnstone M, Wilson P (1998) The memory fragmentation problem: solved? In: Proc of the int symposium on memory management (ISMM98), Vancouver, Canada. ACM Press

  11. Knuth D (1973) Fundamental Algorithms. The art of computer programming, vol 1. Addison–Wesley, Reading

  12. LBNLab (2000) The Internet traffic archive. Lawrence Berkeley National Laboratory, http://ita.ee.lbl.gov/

  13. Lea D (1996) A memory allocator. Unix/Mail 6/96

  14. Masmano M, Ripoll I, Crespo A (2003) Dynamic storage allocation for real-time embedded systems. In: Real-time systems symposium, work-in-progress session, Cancun, Mexico

  15. Masmano M, Ripoll I, Crespo A, Real J (2004) TLSF: a new dynamic memory allocator for real-time systems. In: 16th Euromicro conference on real-time systems, Catania, Italy. IEEE, pp 79–88

  16. Masmano M, Ripoll I, Real J, Crespo A, Wellings AJ (2007) Implementation of a constant-time dynamic storage allocator. Softw Pract Exp. DOI: 10.1002/spe.858

  17. Ni N, Bhuyan L (2002) Fair scheduling in Internet routers. IEEE Trans Comput 51(6):686–701

  18. Nielsen NR (1977) Dynamic memory allocation in computer simulation. Commun ACM 20(11):864–873

  19. Ogasawara T (1995) An algorithm with constant execution time for dynamic storage allocation. In: 2nd int workshop on real-time computing systems and applications, p 21

  20. Peterson J, Norman T (1977) Buddy systems. Commun ACM 20(6):421–431

  21. Puaut I (2002) Real-time performance of dynamic memory allocation algorithms. In: 14th Euromicro conference on real-time systems, p 41

  22. Puschner P, Burns A (2000) A review of worst-case execution-time analysis. J Real-Time Syst 18(2/3):115–128

  23. Robson JM (1971) An estimate of the store size necessary for dynamic storage allocation. J ACM 18(2):416–423

  24. Robson JM (1974) Bounds for some functions concerning dynamic storage allocation. J ACM 21(3):491–499

  25. Robson JM (1977) Worst case fragmentation of first fit and best fit storage allocation strategies. Comput J 20(3):242–244

  26. Sedgewick R (1998) Algorithms in C, 3rd edn. Addison–Wesley, Reading

  27. Shore J (1975) On the external storage fragmentation produced by first-fit and best-fit allocation strategies. Commun ACM 18(8):433–440

  28. Stephenson CJ (1983) Fast fits: new methods of dynamic storage allocation. Oper Sys Rev 15(5). Also in Proceedings of ninth symposium on operating systems principles, Bretton Woods, New Hampshire, October 1983

  29. Wilson PR, Johnstone MS, Neely M, Boles D (1995) Dynamic storage allocation: a survey and critical review. In: Baker H (ed) Proc of the int workshop on memory management, Kinross, Scotland, UK, vol 986. Springer, Berlin, pp 1–116

  30. Zorn B, Grunwald D (1994) Evaluating models of memory allocation. ACM Trans Model Comput Simul 107–131

Download references

Author information

Correspondence to Alfons Crespo.

Additional information

This work was partially supported by FRESCOR (IST/5-034026), ARTIST2 (IST NoE 004527) and Thread (TIC2005-08665).

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Masmano, M., Ripoll, I., Balbastre, P. et al. A constant-time dynamic storage allocator for real-time systems. Real-Time Syst 40, 149–179 (2008). https://doi.org/10.1007/s11241-008-9052-7

Download citation

Keywords

  • Dynamic storage allocation
  • Real-time allocators
  • Allocation algorithms evaluation