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

About This Presentation
Title:

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

Description:

Efficient Computation of May-Happen-in-Parallel Information for Concurrent Java Programs ... statements that may execute in parallel in a multithreaded program ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 21
Provided by: ece5
Learn more at: https://www.ece.lsu.edu
Category:

less

Transcript and Presenter's Notes

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


1
Efficient Computation of May-Happen-in-Parallel
Information for Concurrent Java Programs
  • Rajkishore Barik
  • rajbarik_at_in.ibm.com

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)

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

4
Example
  • 1 class Shared int field0
  • 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 Thread10
  • 8 for(int i0ilt10i)
  • 9 tai new Task1()
  • 10 tai.start()
  • 11
  • 12 s.field
  • 13 Thread t2 new Task1()
  • 14 t2.start()
  • 15 s.field
  • 16
  • 17
  • 18 class Task1 extends Thread

5
Thread Model
  • Abstract Thread (ti)
  • Compile-time entity that corresponds to
    invocation of Threadstart in a context
  • isUniqueti holds if ti has unique runtime
    correspondence
  • Intra-thread control flow graph,
  • ICFG(ti) ltV(ti), E(ti)gt
  • 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
  • locksvi denotes the set of objects that are
    locked while executing vi cV(ti)

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

7
MHP Computation
  • MHP Computation
  • 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 )

8
MHP Computation

9
MHP Computation

10
MHP Computation

11
MHP Computation
  • Node-level MHP

12
MHP Computation

13
MHP Computation

14
MHP Computation
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
  • 15 Determine vim Èvjn
  • 16 end for
  • 17 end for
  • 18 end for
  • 19 end for

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

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

18
Experimental Results
19
Experimental Results

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.
Write a Comment
User Comments (0)
About PowerShow.com