- Loading...
Submitting Member:
Name of Contact Person:
E-Mail Address:
Telephone Number:
Fax Number:
Specification Lead:
E-Mail Address:
Telephone Number:
Fax Number:
Initial Expert Group Membership:
Supporting this JSR:
The performance of many applications depends heavily on the efficiency of context switch operation of their underlying threading model.
Java applications almost exclusively use java.lang.Thread (or some abstracted form thereof) as threading model, which is a heavyweight, operating system level facility.
Fast, user-level context switching in the form of coroutines would be beneficial for any application that has to deal with concurrent sessions or interactions or other types of program units that need to be interleaved.
Many dynamic languages that have JVM-based runtime environments already support coroutine-like features.
Thus, coroutine support would also help these runtime environments provide an efficient implementation of these features.
Coroutines can be implemented very efficiently.
They can be applied to all platforms that at the moment support threading, and could be used as a lightweight alternative to threading on platforms that don't.
The current java.lang.Thread system is designed for preemptive, operating-system level context switching.
This inherently is orders of magnitude slower that user-level context switching.
Coroutines as a programming concept have been around since the early days of computer science, the term "coroutine" itself was coined in 1963 by Melvin Conway (http://dx.doi.org/10.1145%2F366663.366704).
They are available in numerous programming languages and runtime environments.
From a language design perspective, coroutines are a generalization of subroutines.
When they are invoked, they start execution at their first statement and they can subsequently transfer control to some other coroutine (via an operation often called yield).
The state of the local variables and the expression stack at the transfer point is preserved.
When control is transferred back, the coroutine resumes the preserved state and continues to run from the point where it relinquished control.
Coroutines can also be seen as a limited form of continuations, called one-shot continuations.
From a VM perspective, coroutines can be seen as a limited version of threads that happen to transfer control only at some user-specified points in the program.
For the sake of this document, this is the most useful definition, because it can be used to infer sensible memory model and runtime semantics for coroutines.
Coroutines have been seen as an inferior alternative to full-blown threads, because of the manual context switching.
However, there are situations in which manual context switching makes sense or is even desired.
We hope to deliver the final specification, reference implementation, and TCK in XXX. A rough estimate of the schedule would be
XXX Expert group formed
XXX Expert draft
XXX Early Draft review
XXX Public Review
XXX Proposed Final Draft
XXX Final release (aligned with Java EE 6 dates)
The primary means of communication will be email and conference calls. Face-to-face meetings will be scheduled if needed. We will solicit feedback from the community. See section 2.15 for the transparency measures we will use.
The Expert Group will publish early drafts for review by the community at convenient points during the development of the specification. The Expert Group will solicit feedback from the community via public fora(e.g., public presentations, blogs, and other online postings).
The thesis should provide a starting point for discussions about the features that a coroutine implementation should provide, and the prototype implementation can be seen as a proof-of-concept that can be used to explore the API design and performance characteristics.