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.
Keywords
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Most real-time systems have a specific set of priorities they support.
- 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
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)
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)
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)
Cheney, C.J.: A nonrecursive list compacting algorithm. Commun. ACM 13(11), 677–678 (1970)
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)
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)
Gosling, J., Bollella, G.: The Real-Time Specification for Java. Addison-Wesley Longman Publishing Co., Inc., Boston (2000)
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
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)
Hamza, H., Counsell, S.: Region-based RTSJ memory management: State of the art. Sci. Comput. Program. 77(5), 644–659 (2012)
Hughes, J.: Why functional programming matters. Comput. J. 32(2), 98–107 (1989)
JSR 302: Safety Critical Java Technology (2007)
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)
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)
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)
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
Milner, R., Tofte, M., Macqueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997)
MLton. http://www.mlton.org
Murphy, J.C., et al.: A survey of real-time capabilities in functional languages and compilers. Concurr. Comput.: Pract. Exp. 31(4), e4902 (2019)
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)
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)
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)
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)
Sivaramakrishnan, K.C., Ziarek, L., Jagannathan, S.: MultiMLton: A multicore-aware runtime for standard ML. J. Funct. Program. 24, 613–674 (2014)
Timber: A gentle introduction. http://www.timber-lang.org/index_gentle.html
Tofte, M., Talpin, J.P.: Region-based memory management. Inf. Comput. 132(2), 109–176 (1997)
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)
Acknowledgements
This work has been support in part by National Science Foundation grants: CCF 1749539 and CNS 1823230.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
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)