Skip to main content

An efficient implementation for coroutines

  • Functional Languages
  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 637))

Abstract

Emulating coroutines with first-class continuations imposes an unacceptable overhead in managing function frames when there is an intensive exchange of control. This paper presents a high-performance implementation for a restricted class of continuations. These continuations are exploited in a simple coroutine mechanism, reaching a rate of 430,000 control exchanges per second on a modern RISC processor. As an extra feature, first-class continuations are recovered from the restricted class.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Andrew W. Appel: “Garbage Collection Can Be Faster Than Stack Allocation,” Information Processing Letters 25, 1987, 275–279.

    Article  Google Scholar 

  2. Andrew W. Appel: “Simple Generational Garbage Collection and Fast Allocation”, Software-Practice and Experience, 19(2), February 1989, 171–183.

    Google Scholar 

  3. Daniel G. Bobrow and Ben Wegbreit: “A Model and Stack Implementation of Multiple Environments,” Communications of the ACM, 16(10), October 1973, 591–603.

    Article  Google Scholar 

  4. William D. Clinger, Anne H. Hartheimer and Eric M. Ost: “Implementation Strategies for Continuations,” Proceedings of the 1988 ACM Conference on Lisp and Functional Programming, July 1988, 124–131.

    Google Scholar 

  5. Richard P. Gabriel: Performance and Evaluation of Lisp Systems, the MIT Press, 1985.

    Google Scholar 

  6. Christopher T. Haynes, Daniel P. Friedman and Mitchell Wand: “Obtaining Coroutines with Continuations”, Computer Languages, 11(3/4), 1986, 143–153.

    Article  Google Scholar 

  7. Robert Hieb, R. Kent Dybvig and Carl Bruggeman: “Representing Control in Presence of First-Class Continuations,” Proceedings of the ACM SIGPLAN'90 Conference on Programming Language Design and Implementation, White Plains, New York, June 20–22, 1990, 66–77.

    Google Scholar 

  8. Henry Lieberman and Carl Hewitt: “A Real-Time Garbage Collector Based on the Lifetimes of Objects,” Communications of the ACM, 26(6), June 1983, 419–429.

    Article  Google Scholar 

  9. Katsuto Nakajima: “Piling GC — Efficient Garbage Collection for AI Languages —,” Parallel Processing, M. Cosnard, M. H. Barton and M. Vanneschi (Editors), Elsevier Science Publishers B.V. (North Holland), IFIP, 1988, 201–204.

    Google Scholar 

  10. Jonathan A. Rees and William Clinger, eds.: “The Revised3 Report on the Algorithmic Language Scheme,” SIGPLAN Notices, 21(12), December 1986.

    Google Scholar 

  11. Nitsan Séniak: Théorie et pratique de Sqil, un langage intermédiaire pour la compilation des langages fonctionnels, Thèse de Doctorat de l'Université Paris 6, October 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Yves Bekkers Jacques Cohen

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mateu, L. (1992). An efficient implementation for coroutines. In: Bekkers, Y., Cohen, J. (eds) Memory Management. IWMM 1992. Lecture Notes in Computer Science, vol 637. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0017193

Download citation

  • DOI: https://doi.org/10.1007/BFb0017193

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55940-5

  • Online ISBN: 978-3-540-47315-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics