Lukas Stadler,
"Serializable Coroutines for the HotSpot(TM) Java Virtual Machine"
, in Eigenverlag, 2-2011
Original Titel:
Serializable Coroutines for the HotSpot(TM) Java Virtual Machine
Sprache des Titels:
Englisch
Original Kurzfassung:
Coroutines are non-preemptive light-weight 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 trade-off 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 coroutine-like language features, the need for a coroutine implementation has emerged. This thesis presents 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.
The implementation of two advanced concepts, namely thread-to-thread migration and serialization of coroutines, is also explained along with the API that is used to control them. For evaluation purposes, coroutines were used to implement JRuby fibers, which lead to a significant speedup of certain JRuby programs. This thesis concludes with general benchmarks that show the performance of the approach and outline its run-time and memory characteristics.