A Thread of One's Own

Sriram Srinivasan · 2006

Abstract. This paper demonstrates an architecture for suspending and resuming methods in Java using a restricted form of continuation passing style (CPS) transformation. It describes Kilim 1, a toolkit to portably weave threads of control called Fibers, through Java code. The chief contributions of this paper are the set of design choices made for both space and time efficiency in getting one-shot continuations to work on the JVM (in some cases, 60x faster than competing approaches) and to address some tough issues traditionally passed over by others, such as handling of local subroutines and constructors. We are able to support hundreds of thousands of threads of control with switching times of the order of 3 to 4 μs on a low-powered laptop with Sun’s JVM.

Read the paper · More papers on PaperTik