Presentation is loading. Please wait.

Presentation is loading. Please wait.

A New Transpant JAVA Thread Migration System Using Just-in- Time Recompilation Wenzhang Zhu, Cho-Li Wang, Weijian Fang, and Francis C.M. Lau The University.

Similar presentations


Presentation on theme: "A New Transpant JAVA Thread Migration System Using Just-in- Time Recompilation Wenzhang Zhu, Cho-Li Wang, Weijian Fang, and Francis C.M. Lau The University."— Presentation transcript:

1 A New Transpant JAVA Thread Migration System Using Just-in- Time Recompilation Wenzhang Zhu, Cho-Li Wang, Weijian Fang, and Francis C.M. Lau The University of Hong Kong

2 10 Nov th IASTED PDCS 2004, Cambridge, USA2 Java Thread Lightweight computation unit Supports concurrency Supported by Java at language level Shared memory paradigm Multithreading used in large Java programs – e.g. Tomcat, JBoss

3 10 Nov th IASTED PDCS 2004, Cambridge, USA3 True Parallelism for Threads Multiple threads of a program spreading over multiple compute nodes in a cluster A global object space to support data sharing JESSICA2 [8] Heap threads CPU1CPU2CPU3 objects

4 10 Nov th IASTED PDCS 2004, Cambridge, USA4 Dynamic Thread Migration To achieve load balancing and best performance for applications overloaded underloaded balanced workload

5 10 Nov th IASTED PDCS 2004, Cambridge, USA5 Example of Thread Migration We need to carry the code and its execution state to remote node What is in the execution state? At least the program counter the intermediate values of variables i=1; j=2; k=i+j; Node 1 Node 2 Program: 1: i=1; 2: j=2; 3: k=i+j;

6 10 Nov th IASTED PDCS 2004, Cambridge, USA6 Previous Approaches User level Bytecode level [6][7] JVM level [4][5], with JIT [9] Normal thread execution suffers time: checking flags and flushing registers to memory space: code size expanded A multithreaded Java application will have >95% normal execution, <5% migration What we present will help optimize the 95%

7 10 Nov th IASTED PDCS 2004, Cambridge, USA7 JIT Compilation Can we migrate native code? No, machines are not the same Java bytecode in execution JITC Native code Migrate?

8 10 Nov th IASTED PDCS 2004, Cambridge, USA8 New Approach Derive portable bytecode-oriented thread context (BTC) from native (raw) thread context (RTC) Restore BTC to RTC Re-run JIT compilation in both phases to transform the thread context Target node Source node

9 10 Nov th IASTED PDCS 2004, Cambridge, USA9 The Detailed Steps Very quickly …

10 10 Nov th IASTED PDCS 2004, Cambridge, USA10 Just-in-Time Recompilation (source node) Stack walk main() compute() JVM-kernel function()

11 10 Nov th IASTED PDCS 2004, Cambridge, USA11 Just-in-Time Recompilation (source node) Stack walk Frame segmentation main() compute() JVM-kernel function() Java frames to migrate

12 10 Nov th IASTED PDCS 2004, Cambridge, USA12 Just-in-Time Recompilation (source node) Stack walk Frame segmentation main() compute() Bytecode PC positioning incl %ebx cmpl $0x1e, %ebx jl 0x iinc 1, 1 iload_1 bipush 30 if_icmplt 5 Mapping

13 10 Nov th IASTED PDCS 2004, Cambridge, USA13 Just-in-Time Recompilation (source node) Stack walk Frame segmentation compute() Bytecode PC positioning incl %ebx cmpl $0x1e, %ebx jl 0x iinc 1, 1 iload_1 bipush 30 if_icmplt 5 Breakpoint selection getstatic #2 return breakpoint

14 10 Nov th IASTED PDCS 2004, Cambridge, USA14 Just-in-Time Recompilation (source node) Stack walk Frame segmentation compute() Bytecode PC positioning Breakpoint selection Type derivation local 0: java.lang.thread local 1: int stack 0: float stack 1: int main() local 0: java.lang.thread stack 0: double stack 2: double

15 10 Nov th IASTED PDCS 2004, Cambridge, USA15 Just-in-Time Recompilation (source node) Stack walk Frame segmentation compute() Bytecode PC positioning Breakpoint selection Type derivation Translation re-generate native code with breakpoints getstatic #2 Iload_1 inc %ebx cmpl $1e, %ebx jl 0x x : … capture frames… --- save local vars and their type return main()...other native code... jmp start_migration

16 10 Nov th IASTED PDCS 2004, Cambridge, USA16 Just-in-Time Recompilation (source node) Stack walk Frame segmentation compute() Bytecode PC positioning Breakpoint selection Type derivation Translation replace saved return address with the newly generated code inc %ebx cmpl $1e, %ebx jl 0x x : … capture frames… --- save local vars and their type return main()...other native code... jmp start_migration Native code patching saved return address activation record of compute()

17 10 Nov th IASTED PDCS 2004, Cambridge, USA17 Just-in-Time Recompilation (target node) Thread creation Frame PC

18 10 Nov th IASTED PDCS 2004, Cambridge, USA18 Just-in-Time Recompilation (target node) Thread creation Dynamic register patching compute() 1.use JIT compiler to derive register 2.mapping at restoration point generate code stub Register recovering stub: movl %0x1234, %eax movl %0x5678, %ebx... main() Register recovering stub: movl %0x1111, %eax...

19 10 Nov th IASTED PDCS 2004, Cambridge, USA19 Just-in-Time Recompilation (target node) Stack growth %ebp bootstrap frame trampoline frame Ret addr frame 0 reg1 <- value1 reg2 <- value2 jmp restore_point0 Ret addr %ebp frame 1 reg1 <- value1 jmp restore_point1 Compiled methods: compute(){... retore_point1: } main(){... retore_point10: } trampoline bootstrap(){ trampoline(); closing handler(); } Stack rebuilding Thread creation Dynamic register patching Linking code stub and native frames

20 10 Nov th IASTED PDCS 2004, Cambridge, USA20 Experimentation Cluster of 2GHz P4 PCs, running Linux kernel Normal runtime overhead = 0 Migration latency hiding Pre-loading classes needed at target node when the frames have been segmented Overlapping class loading with stack transform at source node

21 10 Nov th IASTED PDCS 2004, Cambridge, USA21 Migration Overhead DNIC: Dynamic Native Code Instrumentation approach JITR: Just-in-Time recompilation approach JITR+Preload: Just-in-Time recompilation with class preloading enabled

22 10 Nov th IASTED PDCS 2004, Cambridge, USA22 Multithreaded Java Application Server Simulation

23 10 Nov th IASTED PDCS 2004, Cambridge, USA23 Parallel Mesh Refinement Simulation

24 10 Nov th IASTED PDCS 2004, Cambridge, USA24 Conclusion This paper presents an efficient transparent Java thread migration system using the technique of JIT recompilation without code instrumentation The idea of using JIT recompilation demonstrates a new use of the JIT compiler to gather runtime information

25 10 Nov th IASTED PDCS 2004, Cambridge, USA25 JESSICA2 Website


Download ppt "A New Transpant JAVA Thread Migration System Using Just-in- Time Recompilation Wenzhang Zhu, Cho-Li Wang, Weijian Fang, and Francis C.M. Lau The University."

Similar presentations


Ads by Google