[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/1852761.1852765acmotherconferencesArticle/Chapter ViewAbstractPublication PagespppjConference Proceedingsconference-collections
research-article

Efficient coroutines for the Java platform

Published: 15 September 2010 Publication History

Abstract

Coroutines are non-preemptive lightweight processes. Their advantage over threads is that they do not have to be synchronized because they pass control to each other explicitly and deterministically. Coroutines are therefore an elegant and efficient implementation construct for numerous algorithmic problems.
Many mainstream languages and runtime environments, however, do not provide a coroutine implementation. Even if they do, these implementations often have less than optimal performance characteristics because of the tradeoff between run time and memory efficiency.
As more and more languages are implemented on top of the Java virtual machine (JVM), many of which provide coroutinelike language features, the need for a coroutine implementation has emerged. We present an implementation of coroutines in the JVM that efficiently handles a large range of workloads. It imposes no overhead for applications that do not use coroutines and performs well for applications that do.
For evaluation purposes, we use our coroutines to implement JRuby fibers, which leads to a significant speedup of certain JRuby programs. We also present general benchmarks that show the performance of our approach and outline its run-time and memory characteristics.

References

[1]
}}D. G. Bobrow and B. Wegbreit. A model and stack implementation of multiple environments. Communications of the ACM, 16(10):591--603, 1973.
[2]
}}J. J. Carroll. Coparsing of RDF & XML. Technical Report HPL-2001-292, Hewlett Packard Laboratories, Nov 2001. URL http://www.hpl.hp.com/techreports/2001/HPL-2001-292.pdf.
[3]
}}M. E. Conway. Design of a separable transition-diagram compiler. Communications of the ACM, 6(7):396--408, 1963.
[4]
}}D. Flanagan and Y. Matsumoto. The Ruby programming language. O'Reilly, 2008. ISBN 9780596516178.
[5]
}}Google. Go programming language, 2009. http://golang.org/.
[6]
}}R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. The implementation of Lua 5.0. Journal of Universal Computer Science, 11(7):1159--1176, 2005.
[7]
}}T. Kotzmann, C. Wimmer, H. Mössenböck, T. Rodriguez, K. Russell, and D. Cox. Design of the Java HotSpot#8482; client compiler for Java 6. ACM Transactions on Architecture and Code Optimization, 5(1): Article 7, 2008.
[8]
}}T. Lindholm and F. Yellin. The Java#8482; Virtual Machine Specification. Addison-Wesley, 2nd edition, 1999.
[9]
}}L. Mateu. An efficient implementation for coroutines. In Proceedings of the International Workshop on Memory Management, volume 637 of Lecture Notes in Computer Science, pages 230--247. Springer, 1992.
[10]
}}A. L. D. Moura and R. Ierusalimschy. Revisiting coroutines. ACM Transactions on Programming Languages and Systems, 31(2):6:1--6:31, Feb. 2009.
[11]
}}P. Murray-Rust, D. Megginson, T. Bray, et al. Simple API for XML, 2004. http://www.saxproject.org/.
[12]
}}M. Paleczny, C. Vick, and C. Click. The Java HotSpot#8482; server compiler. In Proceedings of the Java Virtual Machine Research and Technology Symposium, pages 1--12. USENIX, 2001.
[13]
}}W. Pauli and M. L. Soffa. Coroutine behaviour and implementation. Software---Practice and Experience, 10(3):189--204, Mar. 1980.
[14]
}}L. Stadler, C. Wimmer, T. Würthinger, H. Mössenböck, and J. Rose. Lazy continuations for Java virtual machines. In Proceedings of the International Conference on Principles and Practice of Programming in Java, pages 143--152. ACM, 2009.
[15]
}}The Java HotSpot Performance Engine Architecture. Sun Microsystems, Inc., 2006. http://java.sun.com/products/hotspot/whitepaper.html.
[16]
}}Da Vinci Machine Project. Sun Microsystems, Inc., 2009. http://openjdk.java.net/projects/mlvm/.
[17]
}}The JRuby Community. JRuby, 2010. http://jruby.org/.
[18]
}}The Ruby Community. Ruby Community Website, 2010. http://www.ruby-lang.org/.
[19]
}}D. Thomas, D. Hansson, L. Breedt, M. Clark, J. D. Davidson, J. Geht-land, and A. Schwarz. Agile Web Development with Rails. Pragmatic Bookshelf, 2006. ISBN 0977616630.
[20]
}}TIOBE Software BV. Tiobe programming community index, April 2010. http://www.tiobe.com/tpci.htm.
[21]
}}R. M. Weatherly and E. H. Page. Efficient process interaction simulation in Java: Implementing co-routines within a single Java thread. Winter Simulation Conference, 2:1437--1443, 2004.

Cited By

View all
  • (2023)Introducing the Kotlin Simulation Library (KSL)Proceedings of the Winter Simulation Conference10.5555/3643142.3643418(3311-3322)Online publication date: 10-Dec-2023
  • (2023)Out of Hand for Hardware? Within Reach for Software!Proceedings of the 19th Workshop on Hot Topics in Operating Systems10.1145/3593856.3595898(30-37)Online publication date: 22-Jun-2023
  • (2023)Introducing the Kotlin Simulation Library (KSL)2023 Winter Simulation Conference (WSC)10.1109/WSC60868.2023.10407606(3311-3322)Online publication date: 10-Dec-2023
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Other conferences
PPPJ '10: Proceedings of the 8th International Conference on the Principles and Practice of Programming in Java
September 2010
173 pages
ISBN:9781450302692
DOI:10.1145/1852761
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • Technical University of Vienna

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 September 2010

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Java
  2. activation
  3. coroutine
  4. optimization
  5. performance
  6. stack frame
  7. virtual machine

Qualifiers

  • Research-article

Conference

PPPJ '10
Sponsor:
PPPJ '10: Principles and Practice of Programming in Java
September 15 - 17, 2010
Vienna, Austria

Acceptance Rates

Overall Acceptance Rate 29 of 58 submissions, 50%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)18
  • Downloads (Last 6 weeks)0
Reflects downloads up to 18 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Introducing the Kotlin Simulation Library (KSL)Proceedings of the Winter Simulation Conference10.5555/3643142.3643418(3311-3322)Online publication date: 10-Dec-2023
  • (2023)Out of Hand for Hardware? Within Reach for Software!Proceedings of the 19th Workshop on Hot Topics in Operating Systems10.1145/3593856.3595898(30-37)Online publication date: 22-Jun-2023
  • (2023)Introducing the Kotlin Simulation Library (KSL)2023 Winter Simulation Conference (WSC)10.1109/WSC60868.2023.10407606(3311-3322)Online publication date: 10-Dec-2023
  • (2021)A concurrency model for JavaScript with cooperative cancellationProceedings of the 14th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3486608.3486911(55-67)Online publication date: 17-Oct-2021
  • (2020)Achieving Efficient Structured Concurrency through Lightweight Fibers in Java Virtual Machine2020 43rd International Convention on Information, Communication and Electronic Technology (MIPRO)10.23919/MIPRO48935.2020.9245253(1752-1757)Online publication date: 28-Sep-2020
  • (2020)Design and Implementation of Coroutine Scheduling System on SW26010Proceedings of the 5th International Conference on Big Data and Computing10.1145/3404687.3404700(114-120)Online publication date: 28-May-2020
  • (2017)Practical partial evaluation for high-performance dynamic language runtimesACM SIGPLAN Notices10.1145/3140587.306238152:6(662-676)Online publication date: 14-Jun-2017
  • (2017)Practical partial evaluation for high-performance dynamic language runtimesProceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3062341.3062381(662-676)Online publication date: 14-Jun-2017
  • (2015)Lua-Based Virtual Machine Platform for Spacecraft On-Board Control SoftwareProceedings of the 2015 IEEE 13th International Conference on Embedded and Ubiquitous Computing (EUC)10.1109/EUC.2015.21(44-51)Online publication date: 21-Oct-2015
  • (2015)Light-weight Synchronous Java (SJL)Computing10.1007/s00607-014-0416-797:3(281-307)Online publication date: 1-Mar-2015
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media