Skip to main content

RTMLton: An SML Runtime for Real-Time Systems

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2020)

Abstract

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.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Most real-time systems have a specific set of priorities they support.

  2. 2.

    Almost all dynamically allocated arrays are small and fit into one chunk making them O(1) access and large arrays are statically allocated and their size known up front so the O(log(n)) access time can be taken into consideration when validating the system.

References

  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)

    Article  Google Scholar 

  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)

    Article  MathSciNet  Google Scholar 

  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. Cheney, C.J.: A nonrecursive list compacting algorithm. Commun. ACM 13(11), 677–678 (1970)

    Article  Google Scholar 

  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. 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)

    Article  Google Scholar 

  7. Gosling, J., Bollella, G.: The Real-Time Specification for Java. Addison-Wesley Longman Publishing Co., Inc., Boston (2000)

    Google Scholar 

  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). https://doi.org/10.1007/3-540-45361-X_8

    Chapter  MATH  Google Scholar 

  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. Hamza, H., Counsell, S.: Region-based RTSJ memory management: State of the art. Sci. Comput. Program. 77(5), 644–659 (2012)

    Article  Google Scholar 

  11. Hughes, J.: Why functional programming matters. Comput. J. 32(2), 98–107 (1989)

    Article  Google Scholar 

  12. JSR 302: Safety Critical Java Technology (2007)

    Google Scholar 

  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. 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. 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)

    Article  Google Scholar 

  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). https://doi.org/10.1007/3-540-47884-1_3

    Chapter  Google Scholar 

  17. Milner, R., Tofte, M., Macqueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997)

    Book  Google Scholar 

  18. MLton. http://www.mlton.org

  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)

    Article  Google Scholar 

  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. 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. 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. 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. Sivaramakrishnan, K.C., Ziarek, L., Jagannathan, S.: MultiMLton: A multicore-aware runtime for standard ML. J. Funct. Program. 24, 613–674 (2014)

    Article  Google Scholar 

  25. Timber: A gentle introduction. http://www.timber-lang.org/index_gentle.html

  26. Tofte, M., Talpin, J.P.: Region-based memory management. Inf. Comput. 132(2), 109–176 (1997)

    Article  MathSciNet  Google Scholar 

  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 

Download references

Acknowledgements

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

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bhargav Shivkumar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Shivkumar, B., Murphy, J., Ziarek, L. (2020). RTMLton: An SML Runtime for Real-Time Systems. In: Komendantskaya, E., Liu, Y. (eds) Practical Aspects of Declarative Languages. PADL 2020. Lecture Notes in Computer Science(), vol 12007. Springer, Cham. https://doi.org/10.1007/978-3-030-39197-3_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-39197-3_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-39196-6

  • Online ISBN: 978-3-030-39197-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics