“Carbon Credits” for Resource-Bounded Computations Using Amortised Analysis

  • Steffen Jost
  • Hans-Wolfgang Loidl
  • Kevin Hammond
  • Norman Scaife
  • Martin Hofmann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5850)


Bounding resource usage is important for a number of areas, notably real-time embedded systems and safety-critical systems. In this paper, we present a fully automatic static type-based analysis for inferring upper bounds on resource usage for programs involving general algebraic datatypes and full recursion. Our method can easily be used to bound any countable resource, without needing to revisit proofs. We apply the analysis to the important metrics of worst-case execution time, stack- and heap-space usage. Our results from several realistic embedded control applications demonstrate good matches between our inferred bounds and measured worst-case costs for heap and stack usage. For time usage we infer good bounds for one application. Where we obtain less tight bounds, this is due to the use of software floating-point libraries.


Operational Semantic Inverted Pendulum Carbon Credit Share Rule Resource Variable 
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.
    Albert, E., Genaim, S., Gómez-Zamalloa, M.: Live Heap Space Analysis for Languages with Garbage Collection. In: Proc. ISMM 2009: Intl. Symp. on Memory Management, Dublin, Ireland, June 2009, pp. 129–138. ACM, New York (2009)CrossRefGoogle Scholar
  2. 2.
    Berkelaar, M., Eikland, K., Notebaert, P.: lp_solve: Open source (mixed-integer) linear programming system. GNU LGPL (Lesser General Public Licence),
  3. 3.
    Braberman, V., Fernández, F., Garbervetsky, D., Yovine, S.: Parametric Prediction of Heap Memory Requirements. In: Proc. ISMM 2008: Intl. Symp. on Memory Management, Tucson, USA, June 2008, pp. 141–150. ACM, New York (2008)CrossRefGoogle Scholar
  4. 4.
    Campbell, B.: Amortised Memory Analysis Using the Depth of Data Structures. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 190–204. Springer, Heidelberg (2009)Google Scholar
  5. 5.
    Chin, W.-N., Khoo, S.-C.: Calculating Sized Types. Higher-Order and Symbolic Computing 14(2,3), 261–300 (2001)zbMATHCrossRefGoogle Scholar
  6. 6.
    Chin, W.-N., Nguyen, H., Popeea, C., Qin, S.: Analysing Memory Resource Bounds for Low-Level Programs. In: Proc. ISMM 2008: Intl. Symp. on Memory Management, Tucson, USA, June 2008, pp. 151–160. ACM, New York (2008)CrossRefGoogle Scholar
  7. 7.
    Crary, K., Weirich, S.: Resource Bound Certification. In: Proc. POPL 2000: ACM Symp. on Principles of Prog. Langs., Boston, USA, January 2000, pp. 184–198. ACM, New York (2000)Google Scholar
  8. 8.
    Ferdinand, C., Martin, F., Wilhelm, R., Alt, M.: Cache Behavior Prediction by Abstract Interpretation. Science of Comp. Prog. 35(2), 163–189 (1999)zbMATHCrossRefGoogle Scholar
  9. 9.
    Hammond, K., Michaelson, G.: Hume: a Domain-Specific Language for Real-Time Embedded Systems. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 37–56. Springer, Heidelberg (2003)Google Scholar
  10. 10.
    Hofmann, M.: A Type System for Bounded Space and Functional In-Place Update. Nordic Journal of Computing 7(4), 258–289 (Winter 2000)zbMATHMathSciNetGoogle Scholar
  11. 11.
    Hofmann, M., Jost, S.: Static Prediction of Heap Space Usage for First-Order Functional Programs. In: Proc. POPL 2003: ACM Symp. on Principles of Prog. Langs., New Orleans, USA, January 2003, pp. 185–197. ACM, New York (2003)Google Scholar
  12. 12.
    Hofmann, M., Jost, S.: Type-Based Amortised Heap-Space Analysis. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 22–37. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  13. 13.
    Hughes, R., Pareto, L., Sabry, A.: Proving the Correctness of Reactive Systems Using Sized Types. In: Proc. POPL 1996: ACM Symp. on Principles of Prog. Langs, St. Petersburg Beach, USA, January 1996, pp. 410–423. ACM, New York (1996)Google Scholar
  14. 14.
    Kuo, S.M., Lee, B.H., Tian, W.: Real-Time Digital Signal Processing: Implementations and Applications, 2nd edn., April 2006. Wiley, Chichester (2006)Google Scholar
  15. 15.
    Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)Google Scholar
  16. 16.
    Shkaravska, O., van Kesteren, R., van Eekelen, M.: Polynomial Size Analysis of First-Order Functions. In: Della Rocca, S.R. (ed.) TLCA 2007. LNCS, vol. 4583, pp. 351–365. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  17. 17.
    Tarjan, R.E.: Amortized Computational Complexity. SIAM Journal on Algebraic and Discrete Methods 6(2), 306–318 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Vasconcelos, P., Hammond, K.: Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 86–101. Springer, Heidelberg (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Steffen Jost
    • 1
  • Hans-Wolfgang Loidl
    • 2
  • Kevin Hammond
    • 1
  • Norman Scaife
    • 3
  • Martin Hofmann
    • 2
  1. 1.St Andrews UniversitySt AndrewsScotland, UK
  2. 2.Ludwig-Maximilians UniversityMunichGermany
  3. 3.Université Blaise-PascalClermont-FerrandFrance

Personalised recommendations