70 likes | 183 Views
This paper discusses the implementation of a Java system aimed at achieving very low-cost thread creation and high scalability. Utilizing a sample program based on the Fibonacci sequence, we propose a prototype implemented on the Extensible Java PreProcessor Kit (EPP). This approach translates Java source code to effectively manage thread creation with only 500 lines of code. We explore the Lazy Task Creation (LTC) technique to reduce thread creation costs, while addressing the challenges inherent in Java’s stack management. Alternatives for fine-grain thread implementation are also discussed.
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?