Download presentation
Presentation is loading. Please wait.
Published byTimo Mikkola Modified over 6 years ago
1
Rajkishore Barik rajbarik@in.ibm.com
Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs Rajkishore Barik 9/21/2018 LCPC'05
2
Introduction May-happen-in-parallel (MHP) analysis:
Statically determines statements that may execute in parallel in a multithreaded program Application: Detecting synchronization anomalies Program optimization Debuggers and program understanding tools Data flow analysis Enforce ordering among shared accesses Complexity: NP-complete (Taylor) 9/21/2018 LCPC'05
3
Related Work B4 analysis (Callahan and Subhlok) Ada: Java:
Interprocedural B4 analysis (Duesterwald and Soffa) Non-concurrency analysis (Masticola and Ryder) May-Happen-in-Parallel analysis (Naumovich and Avrunin) Java: Data flow analysis Constructs: start, join, notify, wait, notifyAll, locks Number of runtime threads need to be explicitly enumerated during static analysis Worst-case complexity: (pN)3 where p is the number of runtime threads and N is the number of PEG nodes per thread Happens-before, happens-after and happens-in-parallel (Sura et al.) Constructs: start, join, locks 9/21/2018 LCPC'05
4
Example 9/21/2018 LCPC'05 1 class Shared { int field=0; }
2 class Main { 3 static Shared s; 4 public static void main(String[] args) { 5 s = new Shared(); 6 s.field++; 7 Thread[] ta = new Thread[10]; 8 for(int i=0;i<10;i++) { 9 ta[i] = new Task1(); ta[i].start(); 11 } 12 s.field++; 13 Thread t2 = new Task1(); 14 t2.start(); 15 s.field++; 16 } 17 } 18 class Task1 extends Thread { 19 public void run() { 20 Main.s.field++; 21 } 22 } 9/21/2018 LCPC'05
5
Thread Model Abstract Thread (ti):
Compile-time entity that corresponds to invocation of Thread::start in a context isUnique[ti] holds if ti has unique runtime correspondence Intra-thread control flow graph, ICFG(ti) = <V(ti), E(ti)> V(ti) = USE(ti) 4 ASS(ti) 4 NEW(ti) 4 BEGIN(ti) 4 END(ti ) 4 ENTRY(ti ) 4 EXIT(ti) 4 CSTART(ti) 4 CJOIN(ti) 4 CALL(ti) 4 ACQUIRE(ti) 4 RELEASE(ti) E(ti) contains both intra and inter procedural control flow edges locks[vi] denotes the set of objects that are locked while executing vi cV(ti) 9/21/2018 LCPC'05
6
Program Representation
Must-join abstract thread (tj): CJOIN(ti,tj) postdom CSTART(tk,tj) and ti = tk Thread Creation Tree (TCT) Encodes start relationship among abstract threads Nodes are abstract threads; Edges represent thread creation Nodes in TCT are colored black if it is not a must-join abstract thread yca(ti,tj) denotes the youngest common ancestor of ti and tj in TCT canc(ti,tj) denotes the child of ti that is an ancestor of tj 9/21/2018 LCPC'05
7
MHP Computation MHP Computation: Thread-level MHP:
Thread-level MHP (Èt) Node-level MHP (Èn) Thread-level MHP: ti Èt tj = true, if ti c anc(tj ) or tj c anc(ti ) 9/21/2018 LCPC'05
8
MHP Computation 9/21/2018 LCPC'05
9
MHP Computation 9/21/2018 LCPC'05
10
MHP Computation 9/21/2018 LCPC'05
11
MHP Computation Node-level MHP 9/21/2018 LCPC'05
12
MHP Computation 9/21/2018 LCPC'05
13
MHP Computation 9/21/2018 LCPC'05
14
MHP Computation 9/21/2018 LCPC'05
15
MHP Computation Algorithm
1. Identify abstract threads and their ICFGs. 2. for every abstract thread ti do 3. Compute postdom for every node in Vi. 4. Compute reachability information. 5. for every child abstract thread tj of ti do 6. Compute start-dominance information w.r.to tj. 7. end for 8. Add a node to TCT. 9. end for 10. Compute must-join chains and yca information. 11. for all abstract thread ti do 12 for all abstract thread tj do 13 for all vim cVi do 14 for all vjn cVj do Determine vim Èvjn 16 end for 17 end for 18 end for 19 end for 9/21/2018 LCPC'05
16
Complexity Worst-case complexity is (kN)2, where
k is the number of abstract threads and N is the number of ICFG nodes per thread 9/21/2018 LCPC'05
17
Experimental Setup Infrastructure Benchmarks Comparison
ERCO (ETH Research COmpiler at ETH, Zurich) Pentium IV at 2.66GHz on RedHat Linux Benchmarks Java Grande Forum Philo, tsp, elevator, sor and mtrt Comparison Naumovich et al, our approach 9/21/2018 LCPC'05
18
Experimental Results 9/21/2018 LCPC'05
19
Experimental Results 9/21/2018 LCPC'05
20
Conclusion A new thread model based on context and flow sensitive analysis is presented. MHP computation is split into thread-level and node-level based on TCT and is obtained efficiently. TCT depicts interaction among threads and can perform various thread structure analysis. Our MHP algorithm is on an average 1.77x faster than Naumovich et al. 9/21/2018 LCPC'05
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.