Abstract
Threads can easily be implemented using first-class continuations, but the straightforward approaches for doing so lead to space leaks, especially in a language with exceptions like Standard ML. We show how these space leaks arise and give a new implementation for threads that is safe for space.
Similar content being viewed by others
References
Appel, A.W. and MacQueen, D.B. A Standard ML compiler. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture, Lecture Notes in Computer Science. Springer-Verlag, 1987, vol. 274, pp. 301–324.
Biagioni, E., Harper, R., Lee, P., and Milnes, B.G. Signatures for a protocol stack: A systems application of Standard ML. In Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, Orlando, pp. 55–64, June 1994.
Clinger, W.D. Proper tail recursion and space efficiency. In ACM SIGPLAN '98 Conference on Programming Language Design and Implementation, pp. 174–185, June 1998.
Cooper, E.C. and Morrisett, J.G. Adding threads to Standard ML. Technical Report CMU-CS-90-186, School of Computer Science, Carnegie Mellon University, Dec. 1990.
Danvy, O. and Filinski, A. Abstracting control. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pp. 151–160, June 1990.
Felleisen, M. The theory and practice of first-class prompts. In Proceedings of the 15th ACM Symposium on Principles of Programming Languages, pp. 180–190, Jan. 1988.
Gunter, C.A., Rémy, D., and Riecke, J.G. A generalization of exceptions and control in ML-like languages. In Proceedings of the 1995 Conference on Functional Programming Languages and Computer Architecture, pp. 12–23, June 1995.
Haynes, C.T., Friedman, D.P., and Wand, M. Obtaining coroutines with continuations. Computer Languages, 11(3-4):143–153, 1986.
Lee, P. Implementing threads in Standard ML. In Advanced Functional Programming, Lecture Notes in Computer Science, vol. 1129, pp. 115–130, Aug. 1996.
Milner, R., Tofte, M., and Harper, R. The Definition of Standard ML. The MIT Press, Cambridge, MA, 1990.
Nelson, G. (Ed.) Systems Programming with MODULA-3. Prentice Hall, Englewood Cliffs, NJ, 1991.
Reppy, J.H. CML: A higher-order concurrent language. In ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, pp. 293–305, June 1991.
Reppy, J.H. Higher-order concurrency. Ph.D. thesis, Department of Computer Science, Cornell University, Ithaca, New York, Jan. 1992.
Wand, M. Continuation-based multiprocessing. In Proceedings of the 1980 LISP Conference, pp. 19–28, Aug. 1980.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Biagioni, E., Cline, K., Lee, P. et al. Safe-for-Space Threads in Standard ML. Higher-Order and Symbolic Computation 11, 209–225 (1998). https://doi.org/10.1023/A:1010016600604
Issue Date:
DOI: https://doi.org/10.1023/A:1010016600604