RTMLton: An SML Runtime for Real-Time Systems

  • Bhargav ShivkumarEmail author
  • Jeffrey Murphy
  • Lukasz Ziarek
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12007)


There is a growing interest in leveraging functional programming languages in real-time and embedded contexts. Functional languages are appealing as many are strictly typed, amenable to formal methods, have limited mutation, and have simple, but powerful concurrency control mechanisms. Although there have been many recent proposals for specialized domain specific languages for embedded and real-time systems, there has been relatively little progress on adapting more general purpose functional languages for programming embedded and real-time systems. In this paper we present our current work on leveraging Standard ML in the embedded and real-time domains. Specifically we detail our experiences in modifying MLton, a whole program, optimizing compiler for Standard ML, for use in such contexts. We focus primarily on the language runtime, re-working the threading subsystem and garbage collector. We provide preliminary results over a radar-based aircraft collision detector ported to SML.


Real-time systems Predictable GC Functional programming 



This work has been support in part by National Science Foundation grants: CCF 1749539 and CNS 1823230.


  1. 1.
    Arts, T., Benac Earle, C., Derrick, J.: Development of a verified erlang program for resource locking. Int. J. Softw. Tools Technol. Transf. 5(2), 205–220 (2004)CrossRefGoogle Scholar
  2. 2.
    Audebaud, P., Paulin-Mohring, C.: Proofs of randomized algorithms in Coq. Sci. Comput. Program. 74(8), 568–589 (2009). Special Issue on Mathematics of Program Construction (MPC 2006)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Bacon, D.F., Cheng, P., Rajan, V.T.: Controlling fragmentation and space consumption in the metronome, a real-time garbage collector for Java. In: Proceedings of the 2003 ACM SIGPLAN Conference on Language, Compiler, and Tool for Embedded Systems, LCTES 2003, pp. 81–92. ACM, New York (2003)Google Scholar
  4. 4.
    Cheney, C.J.: A nonrecursive list compacting algorithm. Commun. ACM 13(11), 677–678 (1970)CrossRefGoogle Scholar
  5. 5.
    Deters, M., Cytron, R.K.: Automated discovery of scoped memory regions for real-time Java. In: Proceedings of the 3rd International Symposium on Memory Management, ISMM 2002, pp. 132–142. ACM, New York (2002)Google Scholar
  6. 6.
    Dijkstra, E.W., Lamport, L., Martin, A.J., Scholten, C.S., Steffens, E.F.M.: On-the-fly garbage collection: An exercise in cooperation. Commun. ACM 21(11), 966–975 (1978)CrossRefGoogle Scholar
  7. 7.
    Gosling, J., Bollella, G.: The Real-Time Specification for Java. Addison-Wesley Longman Publishing Co., Inc., Boston (2000)Google Scholar
  8. 8.
    Hammond, K.: The dynamic properties of Hume: A functionally-based concurrent language with bounded time and space behaviour. In: Mohnen, M., Koopman, P. (eds.) IFL 2000. LNCS, vol. 2011, pp. 122–139. Springer, Heidelberg (2001). Scholar
  9. 9.
    Hammond, K.: Is it time for real-time functional programming? In: Gilmore, S. (ed.) Revised Selected Papers from the Fourth Symposium on Trends in Functional Programming, TFP 2003, Edinburgh, United Kingdom, 11–12 September 2003. Trends in Functional Programming, vol. 4, pp. 1–18. Intellect (2003)Google Scholar
  10. 10.
    Hamza, H., Counsell, S.: Region-based RTSJ memory management: State of the art. Sci. Comput. Program. 77(5), 644–659 (2012)CrossRefGoogle Scholar
  11. 11.
    Hughes, J.: Why functional programming matters. Comput. J. 32(2), 98–107 (1989)CrossRefGoogle Scholar
  12. 12.
    JSR 302: Safety Critical Java Technology (2007)Google Scholar
  13. 13.
    Kalibera, T., Hagelberg, J., Pizlo, F., Plsek, A., Titzer, B., Vitek, J.: CDX: A family of real-time Java benchmarks. In: Proceedings of the 7th International Workshop on Java Technologies for Real-Time and Embedded Systems, JTRES 2009, pp. 41–50. ACM, New York (2009)Google Scholar
  14. 14.
    Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: A verified implementation of ML. In: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014, pp. 179–191. ACM, New York (2014)Google Scholar
  15. 15.
    Li, M., McArdle, D.E., Murphy, J.C., Shivkumar, B., Ziarek, L.: Adding real-time capabilities to a SML compiler. SIGBED Rev. 13(2), 8–13 (2016)CrossRefGoogle Scholar
  16. 16.
    López, N., Núñez, M., Rubio, F.: Stochastic process algebras meet Eden. In: Butler, M., Petre, L., Sere, K. (eds.) IFM 2002. LNCS, vol. 2335, pp. 29–48. Springer, Heidelberg (2002). Scholar
  17. 17.
    Milner, R., Tofte, M., Macqueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997)CrossRefGoogle Scholar
  18. 18.
  19. 19.
    Murphy, J.C., et al.: A survey of real-time capabilities in functional languages and compilers. Concurr. Comput.: Pract. Exp. 31(4), e4902 (2019)CrossRefGoogle Scholar
  20. 20.
    Nettles, S., O’Toole, J.: Real-time replication garbage collection. In: Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI 1993, pp. 217–226. ACM, New York (1993)Google Scholar
  21. 21.
    Pizlo, F., Ziarek, L., Blanton, E., Maj, P., Vitek, J.: High-level programming of embedded hard real-time devices. In: Proceedings of the 5th European Conference on Computer Systems, EuroSys 2010, pp. 69–82. , ACM, New York (2010)Google Scholar
  22. 22.
    Pizlo, F., Ziarek, L., Maj, P., Hosking, A.L., Blanton, E., Vitek, J.: Schism: fragmentation-tolerant real-time garbage collection. In: Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2010, pp. 146–159. ACM, New York (2010)Google Scholar
  23. 23.
    Siebert, F.: Realtime garbage collection in the JamaicaVM 3.0. In: Proceedings of the 5th International Workshop on Java Technologies for Real-Time and Embedded Systems, JTRES 2007, pp. 94–103. ACM, New York (2007)Google Scholar
  24. 24.
    Sivaramakrishnan, K.C., Ziarek, L., Jagannathan, S.: MultiMLton: A multicore-aware runtime for standard ML. J. Funct. Program. 24, 613–674 (2014)CrossRefGoogle Scholar
  25. 25.
    Timber: A gentle introduction.
  26. 26.
    Tofte, M., Talpin, J.P.: Region-based memory management. Inf. Comput. 132(2), 109–176 (1997)MathSciNetCrossRefGoogle Scholar
  27. 27.
    Wan, Z., Taha, W., Hudak, P.: Real-time FRP. In: Proceedings of the Sixth ACM SIGPLAN International Conference on Functional Programming, ICFP 2001, pp. 146–156. ACM, New York (2001)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.SUNY - University at BuffaloBuffaloUSA

Personalised recommendations