70 likes | 176 Views
Java Meets Fine-grain Multithreading. Yoshihiro Oyama Kenjiro Taura Akinori Yonezawa {oyama,tau,yonezawa}@is.s.u-tokyo.ac.jp University of Tokyo. Goal. We are planning to implement Java system realizing Thread creation with very very low cost High scalability. Sample Program.
E N D
Java MeetsFine-grain Multithreading Yoshihiro Oyama Kenjiro Taura Akinori Yonezawa {oyama,tau,yonezawa}@is.s.u-tokyo.ac.jp University of Tokyo
Goal We are planning to implement Java systemrealizing • Thread creation with very very low cost • High scalability
Sample Program class Pfib { public static int pfib(int n) { if (n < 2) return 1; else { int x, y; sync { fork { x = pfib(n-1); } fork { y = pfib(n-2); } } return x + y; } } } Synchronization block Thread creation
Prototype Implemented • On top of the Extensible Java PreProcessor Kit EPP (by Y. Ichisugi in ETL, Japan) • Java source to source translation • one fork ⇔ one Java thread creation • Only 500-line EPP code • Its performance is out of the question
How to Implement? Q: How can we reduce thread creation cost? A: Lazy Task Creation (LTC) technique seems useful Problem Traditional compilers based on LTC: Stack is managed tricky by compilers and/or runtimes E.g., stack frame info is put into a data structure explicitly But... Java allows to manipulate stack only with call/return/throw even in a bytecode level
Alternativesto Implement Fine-grain Threads • Extending an existing native compiler? • Extending an existing JVM/JIT? • Writing Java source to source translator?