1 / 20

Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs

Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs. Rajkishore Barik rajbarik@in.ibm.com. Introduction. May-happen-in-parallel (MHP) analysis: Statically determines statements that may execute in parallel in a multithreaded program Application :

saeran
Télécharger la présentation

Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs Rajkishore Barik rajbarik@in.ibm.com 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) LCPC'05

  3. Related Work • B4 analysis (Callahan and Subhlok) Ada: • Interprocedural B4 analysis (Duesterwald and Soffa) • Non-concurrency analysis (Masticola and Ryder) • May-Happen-in-Parallel analysis (Naumovich and Avrunin) Java: • May-Happen-in-Parallel analysis (Naumovich and Avrunin) • 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.) • Data flow analysis • Constructs: start, join, locks LCPC'05

  4. Example 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(); 10 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 } 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 vicV(ti) 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 LCPC'05

  7. MHP Computation MHP Computation: • Thread-level MHP (Èt) • Node-level MHP (Èn) Thread-level MHP: ti Èt tj = true, if tic anc(tj ) or tjc anc(ti ) LCPC'05

  8. MHP Computation LCPC'05

  9. MHP Computation LCPC'05

  10. MHP Computation LCPC'05

  11. MHP Computation • Node-level MHP LCPC'05

  12. MHP Computation LCPC'05

  13. MHP Computation LCPC'05

  14. MHP Computation 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 vimcVi do 14 for all vjncVj do 15 Determine vim Èvjn 16 end for 17 end for 18 end for 19 end for 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 LCPC'05

  17. Experimental Setup • Infrastructure • 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 LCPC'05

  18. Experimental Results LCPC'05

  19. Experimental Results 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. LCPC'05

More Related