SlideShare a Scribd company logo
1 of 34
UNICORN: A UNIFIED APPROACH
FOR LOCALIZING NON-DEADLOCK
     CONCURRENCY BUGS

      Sangmin Park, Richard Vuduc,
         and Mary Jean Harrold
            College of Computing
        Georgia Institute of Technology
Concurrency Bugs Technique Studies Conclusion


Motivation


                   Interleaving Space

      Correct          Buggy Interleaving      Buggy Interleaving
    Interleaving        involving single       involving multiple
                           resource                resources




                                                                        2
Concurrency Bugs Technique Studies Conclusion


Existing Techniques
   Detect concurrency bugs — single variable
     Data race detectors [FastTrack, Eraser]
     Order violation detectors [Falcon]
     Atomicity violation detectors [AVIO, Falcon, CTrigger]

   Detect atomicity violations --- multiple variables
       Atomicity violation detectors [ColorSafe, AtomTracker]



   Detect concurrency bugs --- single and multiple
       General bug detectors w/ statistical analysis
        [CCI, Bugaboo, Recon, DefUse]
                                                                          3
Concurrency Bugs Technique Studies Conclusion


Existing Techniques
   Detect concurrency bugs — single variable
     Data race
    Limitation   detectors [FastTrack, Eraser]
    Don't detect concurrency bugs involving multiple
     Order violation detectors [Falcon]
    variables
     Atomicity violation detectors [AVIO, Falcon, CTrigger]

   Detect atomicity violations --- multiple variables
       Atomicity violation detectors [ColorSafe, AtomTracker]



   Detect concurrency bugs --- single and multiple
       General bug detectors w/ statistical analysis
        [CCI, Bugaboo, Recon, DefUse]
                                                                          4
Concurrency Bugs Technique Studies Conclusion


Existing Techniques
   Detect concurrency bugs — single variable
     Data race
    Limitation   detectors [FastTrack, Eraser]
    Don't detect concurrency bugs involving multiple
     Order violation detectors [Falcon]
    variables
     Atomicity violation detectors [AVIO, Falcon, CTrigger]

   Detect atomicity violations — multiple variables
     Atomicity violation detectors [ColorSafe, AtomTracker]




   Detect concurrency bugs --- single and multiple
       General bug detectors w/ statistical analysis
        [CCI, Bugaboo, Recon, DefUse]
                                                                          5
Concurrency Bugs Technique Studies Conclusion


Existing Techniques
   Detect concurrency bugs — single variable
     Data race
    Limitation   detectors [FastTrack, Eraser]
    Don't detect concurrency bugs involving multiple
     Order violation detectors [Falcon]
    variables
     Atomicity violation detectors [AVIO, Falcon, CTrigger]

   Detect atomicity violations — multiple variables
     Atomicity violation detectors [ColorSafe, AtomTracker]
    Limitation
    Don't detect order violations

   Detect concurrency bugs --- single and multiple
       General bug detectors w/ statistical analysis
        [CCI, Bugaboo, Recon, DefUse]
                                                                          6
Concurrency Bugs Technique Studies Conclusion


Existing Techniques
   Detect concurrency bugs — single variable
     Data race
    Limitation   detectors [FastTrack, Eraser]
    Don't detect concurrency bugs involving multiple
     Order violation detectors [Falcon]
    variables
     Atomicity violation detectors [AVIO, Falcon, CTrigger]

   Detect atomicity violations — multiple variables
     Atomicity violation detectors [ColorSafe, AtomTracker]
    Limitation
    Don't detect order violations

   Detect concurrency bugs — single and multiple
       General bug detectors w/ statistical analysis
        [CCI, Bugaboo, Recon, DefUse]
                                                                          7
Concurrency Bugs Technique Studies Conclusion


 Existing Techniques
    Detect concurrency bugs — single variable
      Data race
     Limitation detectors [FastTrack, Eraser]
  Order violation detectors [Falcon]
   Don't detect concurrency bugs involving multiple
   variables
    Atomicity violation detectors [AVIO, Falcon, CTrigger]

  Detect atomicity violations — multiple variables

    Atomicity violation detectors [ColorSafe, AtomTracker]
   Limitation
 Don't detect order violations
    Detect concurrency bugs — single and multiple
   General bug detectors w/ statistical analysis
     
  Limitation
   [CCI, Bugaboo, Recon, DefUse]
 Don't provide bug type information
                                                                       8
Concurrency Bugs Technique Studies Conclusion


Overview
   Concurrency Bugs
     Order  violation
     Single-variable atomicity violation

     Multi-variable atomicity violation

   UNICORN Technique
     Detects three types of concurrency bugs
     Provides bug type information

   Empirical Studies
   Conclusion
                                                                     9
Concurrency Bugs Technique Studies Conclusion


  Bug: Order Violation
             Thread 1                            Thread 2

     void main(…) {                   void * consumer (…) {
       …
       pthread_create(consumer);
         …


W1
         …
         mutex = NULL;
                                 
                                          …
                                           Lock(mutex); R2
         …
                                           …
     }                                }




* This example is from PBZip2.                                             10
Concurrency Bugs Technique Studies Conclusion


  Bug: Single-Variable Atomicity
             Thread 1                           Thread 2

     void new_file(…) {              int mysql_insert(…) {
         …                               // actual insert
         saved_type = log_type;           …
W1       log_type = CLOSED;              if (log_type != CLOSED)
                                                                 R2
         …                                {
         // update file                        LOG.write(…);
         …                                }
W3       log_type = saved_type;           …
         …                           }
     }

* This example is from MySQL-791.                                         11
Concurrency Bugs Technique Studies Conclusion


  Bug: Multi-Variable Atomicity
             Thread 1                            Thread 2

     int mysql_delete(…) {              int mysql_insert(…) {
         …                                  …
         Lock(X);                   
                                           Lock(X);
W1           Table.remove ();                   Table.insert();
                                                                       W2
         Unlock(X);                         Unlock(X);
         …                                  …
         Lock(Y);                           Lock(Y);
W4           LOG.write();                       LOG.write();           W3
         Unlock(Y);                         Unlock(Y);
         …                                  …
     }                                  }
* This example is from MySQL-169.                                         12
Concurrency Bugs Technique Studies Conclusion


  Bug: Multi-Variable Atomicity
             Thread 1                            Thread 2

     int mysql_delete(…) {              int mysql_insert(…) {
         …                                  …


W1
         Lock(X);
             Table.remove ();
                                           Lock(X);
                                                Table.insert();
         Note                                                          W2
         Unlock(X);                         Unlock(X);
         These
         …      three types of concurrency bugs are the
                                        …
         most important types of non-deadlock concurrency
         Lock(Y);                       Lock(Y);
W4       bugs [Lu 08].
           LOG.write();                   LOG.write();    W3
         Unlock(Y);                         Unlock(Y);
         …                                  …
     }                                  }
* This example is from MySQL-169.                                         13
Concurrency Bugs Technique Studies Conclusion


Problematic Access Patterns
#Var          Type          Memory Access Patterns
                                   R1,S(x) W2,S(x)
             Order                 W1,S(x) R2,S(x)
                                  W1,S(x) W2,S(x)
                               R1,S(x) W2,S(x) R1,S(x)
Single
                               W1,S(x) W2,S(x) R1,S(x)
         Single-Variable
                               W1,S(x) R2,S(x) W1,S(x)
            Atomicity
                               W1,S(x) R2,S(x) W1,S(x)
                              W1,S(x) W2,S(x) W1,S(x)
                           W1,S(x) W2,S(x) W2,S(y) W1,S(y)
                           W1,S(x) W2,S(y) W2,S(x) W1,S(y)
                           W1,S(x) W2,S(y) W1,S(y) W2,S(x)       * The patterns
                           W1,S(x) R2,S(x) R2,S(y) W1,S(y)       were identified
Multi
         Multi-Variable
                           W1,S(x) R2,S(y) R2,S(x) W1,S(y)
                                                                 by previous work
          Atomicity                                              [Lu 06, Vaziri
                           R1,S(x) W2,S(x) W2,S(y) R1,S(y)       06, Hammer 08].
                           R1,S(x) W2,S(y) W2,S(x) R1,S(y)
                           R1,S(x) W2,S(y) R1,S(y) W2,S(x)
                                                                              14
                           W1,S(x) R2,S(x) W1,S(y) R2,S(y)
Concurrency Bugs Technique Studies Conclusion


      UNICORN: Overview

    [ Fault-localization technique ]




P                                                                          ranked-
                                  UNICORN                                  patterns
T




                                                                             15
Concurrency Bugs Technique Studies Conclusion


       UNICORN: Overview

    [ UNICORN: A UNIfied approach for localizing non-deadlock COncuRreNcy Bugs ]

                                         Find both single-variable and
                                         multi-variable patterns


                       pairs,                 patterns,                            ranked-
P        Step 1:                   Step 2:              Step 3:
                      outcomes                outcomes                             patterns
       Collect Pairs           Combine Pairs             Rank
T                                                        Patterns
      From Executions           Into Patterns




                        Intuition: Patterns consist of
                        (one or two) pairs


                                                                                     16
Concurrency Bugs Technique Studies Conclusion


  Problematic Access Patterns
#Var       Type           Memory Access Patterns                       Memory Access Pairs
                     R1,S(x) W2,S(x)                        R1,S(x) W2,S(x)
          Order      W1,S(x) R2,S(x)                        W1,S(x) R2,S(x)
                     W1,S(x) W2,S(x)                        W1,S(x) W2,S(x)
                     R1,S(x) W2,S(x) R1,S(x)                R1,S(x) W2,S(x)      W2,S(x) R1,S(x)
Single
                     W1,S(x) W2,S(x) R1,S(x)                W1,S(x) W2,S(x)      W2,S(x) R1,S(x)
          Single-
         Variable    W1,S(x) R2,S(x) W1,S(x)                W1,S(x) R2,S(x)      R2,S(x) W1,S(x)
         Atomicity
                     W1,S(x) R2,S(x) W1,S(x)                W1,S(x) R2,S(x)      R2,S(x) W1,S(x)
                     W1,S(x) W2,S(x) W1,S(x)                W1,S(x) W2,S(x)      W2,S(x) W1,S(x)
                     W1,S(x) W2,S(x) W2,S(y) W1,S(y)        W1,S(x) W2,S(x)      W2,S(y) W1,S(y)
                     W1,S(x) W2,S(y) W2,S(x) W1,S(y)        W1,S(x) W2,S(x)      W2,S(y) W1,S(y)
                     W1,S(x) W2,S(y) W1,S(y) W2,S(x)        W1,S(x) W2,S(x)      W2,S(y) W1,S(y)
                     W1,S(x) R2,S(x) R2,S(y) W1,S(y)        W1,S(x) R2,S(x)      R2,S(y) W1,S(y)
          Multi-
Multi    Variable    W1,S(x) R2,S(y) R2,S(x) W1,S(y)        W1,S(x) R2,S(x)      R2,S(y) W1,S(y)
         Atomicity
                     R1,S(x) W2,S(x) W2,S(y) R1,S(y)        R1,S(x) W2,S(x)      W2,S(y) R1,S(y)
                     R1,S(x) W2,S(y) W2,S(x) R1,S(y)        R1,S(x) W2,S(x)      W2,S(y) R1,S(y)
                     R1,S(x) W2,S(y) R1,S(y) W2,S(x)        R1,S(x) W2,S(x)      W2,S(y) R1,S(y)
                                                                                                   17
                     W1,S(x) R2,S(x) W1,S(y) R2,S(y)        W1,S(x) R2,S(x)      R2,S(y) W1,S(y)
Concurrency Bugs Technique Studies Conclusion


    Step 1: Collect Pairs in Executions

       Collect pairs using sliding window            [Falcon, ICSE 2010]
         Maintain a window per shared variable (pair window)
         Collect WR, RW, WW access-pairs within window




                     pairs,                 patterns,           ranked-
P      Step 1:                   Step 2:              Step 3:   patterns
                    outcomes                outcomes
     Collect Pairs           Combine Pairs             Rank
T                                                      Patterns
    From Executions           Into Patterns




                                                                            18
Concurrency Bugs Technique Studies Conclusion


          Step 1: Collect Pairs in Executions

                                      [Run 1]    Failing
      Thread 1           Thread 2
                                      Accesses
int delete(…) {    int insert(…) {
                                      R0 R0 R1 R1 W0 W0 W1 W2 W3 W4
      …                  …
      Lock(X);           Lock(X);
W1:       Tbl();   W2:       Tbl();   Windows
      Unlock(X);         Unlock(X);   Tbl:                                …
      …                  …            LOG:                                …
      Lock(Y);           Lock(Y);
W4:       LOG();   W3:       LOG();
      Unlock(Y);         Unlock(Y);   Pairs
      …                  …              R0-W0, R0-W1, R1-W0, R1-W1
}                  }                    R0-W0, R0-W1
                                        W1-W2         pairs for the
                                        W3-W4         code in the slide
                                                                              19
Concurrency Bugs Technique Studies Conclusion


          Step 1: Collect Pairs in Executions

      Thread 1           Thread 2

int delete(…) {    int insert(…) {    I                  R   R   R   R   R    R
                                             Pair
                                      D                  1   2   3   4   5    6
      …                  …
                                           W1 (Tbl)-
      Lock(X);           Lock(X);     1                               
                                           W2 (Tbl)
W1:       Tbl();   W2:       Tbl();       W3 (LOG)-
                                      2                                    
      Unlock(X);         Unlock(X);       W4 (LOG)
      …                  …                 W2 (Tbl)-
                                      3                                      
      Lock(Y);           Lock(Y);          W1 (Tbl)

W4:       LOG();   W3:       LOG();       W4 (LOG)-
                                      4                                 
                                          W3 (LOG)
      Unlock(Y);         Unlock(Y);
                                                         F   P   P   F   P    P
      …                  …
}                  }


                                                                             20
Concurrency Bugs Technique Studies Conclusion


    Step 2: Combine Pairs to Patterns

    1. Set pairs to patterns for order violation
    2. Combine pairs to patterns using sliding window
          Sort pairs in time order
          Combine two-pair-based patterns within pattern window


                     pairs,                 patterns,           ranked-
P      Step 1:                   Step 2:              Step 3:   patterns
                    outcomes                outcomes
     Collect Pairs           Combine Pairs             Rank
T                                                      Patterns
    From Executions           Into Patterns




                                                                            21
Concurrency Bugs Technique Studies Conclusion


          Step 2: Combine Pairs to Patterns

                                      [Run 1]    Failing
      Thread 1           Thread 2
                                      Pairs                    Patterns
int delete(…) {    int insert(…) {                             R0-W0
                                      R0-W0
      …                  …            R0-W1                    R0-W1
      Lock(X);           Lock(X);     R0-W0                    R0-W0
                                      R0-W1                    R0-W1
W1:       Tbl();   W2:       Tbl();
                                      R1-W0                    R1-W0
      Unlock(X);         Unlock(X);   R1-W1                    R1-W1
      …                  …            R1-W2                    R1-W2
                                      R1-W0                    R1-W0
      Lock(Y);           Lock(Y);
                                      R1-W1                    R1-W1
W4:       LOG();   W3:       LOG();   R1-W2                    R1-W2
      Unlock(Y);         Unlock(Y);   W1-W2                    W1-W2
                                      W3-W4                    W3-W4
      …                  …
}                  }                                           W1-W2-W3-W4


                                                                             22
Concurrency Bugs Technique Studies Conclusion


          Step 2: Combine Pairs to Patterns

      Thread 1           Thread 2     I                  R   R   R   R   R    R
                                            Pattern
                                      D                  1   2   3   4   5    6
int delete(…) {    int insert(…) {
                                           W1 (Tbl)-
                                      1                               
      …                  …                 W2 (Tbl)
      Lock(X);           Lock(X);         W3 (LOG)-
                                      2                                    
W1:       Tbl();   W2:       Tbl();       W4 (LOG)

      Unlock(X);         Unlock(X);        W2 (Tbl)-
                                      3                                      
                                           W1 (Tbl)
      …                  …
                                          W4 (LOG)-
      Lock(Y);           Lock(Y);     4                                 
                                          W3 (LOG)
W4:       LOG();   W3:       LOG();       W1 (Tbl)-
      Unlock(Y);         Unlock(Y);   5
                                          W2 (Tbl)-
                                                                    
                                          W3 (LOG)-
      …                  …
                                          W4 (LOG)
}                  }
                                                         F   P   P   F   P    P


                                                                             23
Concurrency Bugs Technique Studies Conclusion


    Step 3: Rank Patterns

       Rank patterns
         Compute    suspiciousness of patterns
              Jaccard formula [Abreu07]
                                           failed (P)
               suspiciousness(P) =
                                     totalfailed + passed(P)


                     pairs,                 patterns,           ranked-
P      Step 1:                   Step 2:              Step 3:   patterns
                    outcomes                outcomes
     Collect Pairs           Combine Pairs             Rank
T                                                      Patterns
    From Executions           Into Patterns


                                                                              24
Concurrency Bugs Technique Studies Conclusion


          Step 3: Rank Patterns
                                                                      failed (P)
                                      suspiciousness(P) =
      Thread 1           Thread 2                             totalfailed + passed(P)

int delete(…) {    int insert(…) {    I                  R    R   R    R   R       R
                                             Pattern                                   Susp
                                      D                  1    2   3    4   5       6
      …                  …
                                            W1 (Tbl)-
      Lock(X);           Lock(X);     1                                             0.5
                                            W2 (Tbl)
W1:       Tbl();   W2:       Tbl();        W3 (LOG)-
                                      2                                             0.5
      Unlock(X);         Unlock(X);        W4 (LOG)
      …                  …            3
                                            W2 (Tbl)-
                                                                                      0.0
                                            W1 (Tbl)
      Lock(Y);           Lock(Y);
                                           W4 (LOG)-
W4:       LOG();   W3:       LOG();   4                                               0.0
                                           W3 (LOG)
      Unlock(Y);         Unlock(Y);
                                           W1 (Tbl)-
      …                  …                 W2 (Tbl)-
                                      5                                               1.0
}                  }                       W3 (LOG)-
                                           W4 (LOG)
                                                          F   P   P    F    P      P
                                                                                       25
Concurrency Bugs Technique Studies Conclusion


          Step 3: Rank Patterns
                                                                      failed (P)
                                      suspiciousness(P) =
      Thread 1           Thread 2                             totalfailed + passed(P)

int delete(…) {    int insert(…) {    I                  R    R   R    R   R       R
                                             Pattern                                   Susp
                                      D                  1    2   3    4   5       6
      …                  …
                                            W1 (Tbl)-
      Lock(X);           Lock(X);     1                                             0.5
                                            W2 (Tbl)
W1:       Tbl();   W2:       Tbl();        W3 (LOG)-
             Summary Unlock(X);       2                                            0.5
      Unlock(X);                           W4 (LOG)
      …   UNICORN…                 3
                                       W2 (Tbl)-
                                                                                      0.0
                                       W1 (Tbl)
          •
   Lock(Y); Detects Lock(Y); access pairs
                    memory
                                      W4 (LOG)-
          •
W4: LOG(); Combines pairs into patterns
                W3: LOG();         4
                                      W3 (LOG)
                                                                                     0.0
   Unlock(Y);       Unlock(Y);
          • Ranks patterns w.r.t. suspiciousness
                                      W1 (Tbl)-
      …                  …                 W2 (Tbl)-
                                      5                                              1.0
}                  }                       W3 (LOG)-
                                           W4 (LOG)
                                                          F
                                                          P   P
                                                              F   P    F    P      P
                                                                                       26
Concurrency Bugs Technique Studies Conclusion


Empirical Studies
   Studies
    1. Evaluate effectiveness of the technique
    2. Measure distance of the pattern window
    3. Evaluate efficiency of the technique (see paper)


   Empirical Setup
     Implemented  in Java (Soot) and C++ (LLVM)
     Evaluated on a set of subjects




                                                                   27
Concurrency Bugs Technique Studies Conclusion


Subjects
Language     Program       LOC        % Failed             Bug Type

            TimerThread          68        14.4              Order

            LoadScript       110           49.8     Single-variable atomicity

             MysqlLog            89         2.8     Single-variable atomicity
  C++
Extracted    JsString            95         1.4      Multi-variable atomicity

            MysqlDelete      103            3.8      Multi-variable atomicity

            MysqlSlave           94         0.4      Multi-variable atomicity

              PBZip2             2k         2.8              Order

             Mysql-791      372k           64.0     Single-variable atomicity
  C++
Complete       Aget          1.2k          49.0      Multi-variable atomicity

             Mysql-169      334k           63.0      Multi-variable atomicity

            StringBuffer     1.4k          22.3      Multi-variable atomicity
  Java
              Vector         9.5k           7.6      Multi-variable atomicity
                                                                                28
Concurrency Bugs Technique Studies Conclusion


Study 1: Effectiveness
   Goal
     Todetermine how well UNICORN ranks the
     pattern of the actual bug


   Method
     Set pair-window size to 5
     Set pattern-window size to 100

     Ran each subject 100 times and computed
      suspiciousness and rankings

                                                                 29
Concurrency Bugs Technique Studies Conclusion


 Study 1: Effectiveness
                                                                         1
               Num of   Num of          Susp       Susp            Susp       Rank          Num of
 Program
                Pairs   Patterns       (Pair 1)   (Pair 2)       (Pattern)    (Bug)        Top rank
TimerThread         6              7        1.0              -          1.0            1            3

LoadScript          3              4       0.86        1.0              1.0            1            2

 MysqlLog           4              5       0.02        1.0              1.0            1            2

 JsString           5              8
                                   2       0.04        1.0              1.0            1            3

MysqlDelete         7              1       0.04       0.27              1.0            1            1

MysqlSlave          6          11          0.01       0.66              1.0           31            1

  PBZip2           59         333          0.42              -         0.42            1            6

 Mysql-791       1082       10936           1.0       0.64              1.0            1            4

   Aget            37          94          0.51       0.50             0.70            1            1

 Mysql-169        894        9051          0.63       0.63              1.0            1            7

StringBuffer        8          18          0.58        1.0              1.0            1            3

  Vector           11          25           1.0        1.0              1.0            1            4
                                                                                               30
Concurrency Bugs Technique Studies Conclusion


Study 2: Pattern-window size
   Goal
     Toinvestigate the practicality of the pattern-
     window size


   Method
     Computed    the distance between the two pairs of
      the actual concurrency bugs (using data from
      Study 1)
     Computed the median and maximum distances


                                                                    31
Concurrency Bugs Technique Studies Conclusion


Study 2: Pattern-window size
                 Num of        Num of          Median         Maximum
   Program
                  Pairs        Patterns        distance       distance
  TimerThread             6               7          N/A            N/A

  LoadScript              3               4               2              2

   MysqlLog               4               5               2              2

   JsString               5               8               3              3

  MysqlDelete             7               1               2              2

  MysqlSlave              6               11              2              2

    PBZip2                59         333             N/A            N/A

   Mysql-791         1082          10936              18             27

     Aget                 37          94                  2              3

   Mysql-169          894           9051              41             41

  StringBuffer            8           18                  4              5

    Vector                11          25                  2              2
                                                                             32
Concurrency Bugs Technique Studies Conclusion


Future Work
   Provide information to understand bugs
     Problem: Several patterns ranked top together
     Approach: In-depth analysis on the ranking


   Provide information on test-suite
     Problem: No study on effectiveness vs. test suite
     Approach: Investigation on quality of test suite


   Improve overhead
     Problem: Significant overhead on monitoring
     Approach: Use techniques such as sampling

                                                                      33
Concurrency Bugs Technique Studies Conclusion


Contributions
   UNICORN is the first unified technique that
     detects memory-access pairs, combines pairs to get
      patterns, and ranks patterns with respect to
      suspiciousness
     handles both single- and multi-variable violations

   Empirical studies show that UNICORN
     is effective in identifying patterns associated with
      real bugs
     is efficient
       it needs small-/fixed-sized windows to find patterns
       its runtime overhead comparable to other techniques

                         Questions                                     34

More Related Content

Similar to UNICORN: A Unified Approach for Localizing Non-deadlock Concurrency Bugs

Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns ReconsideredAlex Miller
 
Effective Fault-Localization Techniques for Concurrent Software
Effective Fault-Localization Techniques for Concurrent SoftwareEffective Fault-Localization Techniques for Concurrent Software
Effective Fault-Localization Techniques for Concurrent SoftwareSangmin Park
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindAndreas Czakaj
 
Drd secr final1_3
Drd secr final1_3Drd secr final1_3
Drd secr final1_3Devexperts
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrencyfeng lee
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfKALAISELVI P
 
A exception ekon16
A exception ekon16A exception ekon16
A exception ekon16Max Kleiner
 
U3 JAVA.pptx
U3 JAVA.pptxU3 JAVA.pptx
U3 JAVA.pptxmadan r
 
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]Alex Pruden
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Siouxnikomatsakis
 
Rust: Reach Further
Rust: Reach FurtherRust: Reach Further
Rust: Reach Furthernikomatsakis
 
10 Typical Enterprise Java Problems
10 Typical Enterprise Java Problems10 Typical Enterprise Java Problems
10 Typical Enterprise Java ProblemsEberhard Wolff
 
Dynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDevexperts
 
Unit 4 exceptions and threads
Unit 4 exceptions and threadsUnit 4 exceptions and threads
Unit 4 exceptions and threadsDevaKumari Vijay
 

Similar to UNICORN: A Unified Approach for Localizing Non-deadlock Concurrency Bugs (20)

Exception handling in java
Exception handling  in javaException handling  in java
Exception handling in java
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns Reconsidered
 
17 exceptions
17   exceptions17   exceptions
17 exceptions
 
Effective Fault-Localization Techniques for Concurrent Software
Effective Fault-Localization Techniques for Concurrent SoftwareEffective Fault-Localization Techniques for Concurrent Software
Effective Fault-Localization Techniques for Concurrent Software
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mind
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
Drd secr final1_3
Drd secr final1_3Drd secr final1_3
Drd secr final1_3
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
 
Role of locking
Role of lockingRole of locking
Role of locking
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdf
 
A exception ekon16
A exception ekon16A exception ekon16
A exception ekon16
 
U3 JAVA.pptx
U3 JAVA.pptxU3 JAVA.pptx
U3 JAVA.pptx
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
 
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
 
Rust: Reach Further
Rust: Reach FurtherRust: Reach Further
Rust: Reach Further
 
10 Typical Enterprise Java Problems
10 Typical Enterprise Java Problems10 Typical Enterprise Java Problems
10 Typical Enterprise Java Problems
 
Dynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programs
 
Unit 4 exceptions and threads
Unit 4 exceptions and threadsUnit 4 exceptions and threads
Unit 4 exceptions and threads
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

UNICORN: A Unified Approach for Localizing Non-deadlock Concurrency Bugs

  • 1. UNICORN: A UNIFIED APPROACH FOR LOCALIZING NON-DEADLOCK CONCURRENCY BUGS Sangmin Park, Richard Vuduc, and Mary Jean Harrold College of Computing Georgia Institute of Technology
  • 2. Concurrency Bugs Technique Studies Conclusion Motivation Interleaving Space Correct Buggy Interleaving Buggy Interleaving Interleaving involving single involving multiple resource resources 2
  • 3. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race detectors [FastTrack, Eraser]  Order violation detectors [Falcon]  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations --- multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker]  Detect concurrency bugs --- single and multiple  General bug detectors w/ statistical analysis [CCI, Bugaboo, Recon, DefUse] 3
  • 4. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race Limitation detectors [FastTrack, Eraser] Don't detect concurrency bugs involving multiple  Order violation detectors [Falcon] variables  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations --- multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker]  Detect concurrency bugs --- single and multiple  General bug detectors w/ statistical analysis [CCI, Bugaboo, Recon, DefUse] 4
  • 5. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race Limitation detectors [FastTrack, Eraser] Don't detect concurrency bugs involving multiple  Order violation detectors [Falcon] variables  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations — multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker]  Detect concurrency bugs --- single and multiple  General bug detectors w/ statistical analysis [CCI, Bugaboo, Recon, DefUse] 5
  • 6. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race Limitation detectors [FastTrack, Eraser] Don't detect concurrency bugs involving multiple  Order violation detectors [Falcon] variables  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations — multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker] Limitation Don't detect order violations  Detect concurrency bugs --- single and multiple  General bug detectors w/ statistical analysis [CCI, Bugaboo, Recon, DefUse] 6
  • 7. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race Limitation detectors [FastTrack, Eraser] Don't detect concurrency bugs involving multiple  Order violation detectors [Falcon] variables  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations — multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker] Limitation Don't detect order violations  Detect concurrency bugs — single and multiple  General bug detectors w/ statistical analysis [CCI, Bugaboo, Recon, DefUse] 7
  • 8. Concurrency Bugs Technique Studies Conclusion Existing Techniques  Detect concurrency bugs — single variable  Data race Limitation detectors [FastTrack, Eraser]   Order violation detectors [Falcon] Don't detect concurrency bugs involving multiple variables  Atomicity violation detectors [AVIO, Falcon, CTrigger]  Detect atomicity violations — multiple variables  Atomicity violation detectors [ColorSafe, AtomTracker] Limitation  Don't detect order violations  Detect concurrency bugs — single and multiple General bug detectors w/ statistical analysis  Limitation [CCI, Bugaboo, Recon, DefUse]  Don't provide bug type information 8
  • 9. Concurrency Bugs Technique Studies Conclusion Overview  Concurrency Bugs  Order violation  Single-variable atomicity violation  Multi-variable atomicity violation  UNICORN Technique  Detects three types of concurrency bugs  Provides bug type information  Empirical Studies  Conclusion 9
  • 10. Concurrency Bugs Technique Studies Conclusion Bug: Order Violation Thread 1 Thread 2 void main(…) { void * consumer (…) { … pthread_create(consumer); … W1 … mutex = NULL;   … Lock(mutex); R2 … … } } * This example is from PBZip2. 10
  • 11. Concurrency Bugs Technique Studies Conclusion Bug: Single-Variable Atomicity Thread 1 Thread 2 void new_file(…) { int mysql_insert(…) { …  // actual insert saved_type = log_type; … W1 log_type = CLOSED;  if (log_type != CLOSED) R2 … { // update file LOG.write(…); … } W3 log_type = saved_type; … … } } * This example is from MySQL-791. 11
  • 12. Concurrency Bugs Technique Studies Conclusion Bug: Multi-Variable Atomicity Thread 1 Thread 2 int mysql_delete(…) { int mysql_insert(…) { … … Lock(X);   Lock(X); W1 Table.remove (); Table.insert(); W2 Unlock(X); Unlock(X); … … Lock(Y); Lock(Y); W4 LOG.write(); LOG.write(); W3 Unlock(Y); Unlock(Y); … … } } * This example is from MySQL-169. 12
  • 13. Concurrency Bugs Technique Studies Conclusion Bug: Multi-Variable Atomicity Thread 1 Thread 2 int mysql_delete(…) { int mysql_insert(…) { … … W1 Lock(X); Table.remove ();  Lock(X); Table.insert(); Note W2 Unlock(X); Unlock(X); These … three types of concurrency bugs are the … most important types of non-deadlock concurrency Lock(Y); Lock(Y); W4 bugs [Lu 08]. LOG.write(); LOG.write(); W3 Unlock(Y); Unlock(Y); … … } } * This example is from MySQL-169. 13
  • 14. Concurrency Bugs Technique Studies Conclusion Problematic Access Patterns #Var Type Memory Access Patterns R1,S(x) W2,S(x) Order W1,S(x) R2,S(x) W1,S(x) W2,S(x) R1,S(x) W2,S(x) R1,S(x) Single W1,S(x) W2,S(x) R1,S(x) Single-Variable W1,S(x) R2,S(x) W1,S(x) Atomicity W1,S(x) R2,S(x) W1,S(x) W1,S(x) W2,S(x) W1,S(x) W1,S(x) W2,S(x) W2,S(y) W1,S(y) W1,S(x) W2,S(y) W2,S(x) W1,S(y) W1,S(x) W2,S(y) W1,S(y) W2,S(x) * The patterns W1,S(x) R2,S(x) R2,S(y) W1,S(y) were identified Multi Multi-Variable W1,S(x) R2,S(y) R2,S(x) W1,S(y) by previous work Atomicity [Lu 06, Vaziri R1,S(x) W2,S(x) W2,S(y) R1,S(y) 06, Hammer 08]. R1,S(x) W2,S(y) W2,S(x) R1,S(y) R1,S(x) W2,S(y) R1,S(y) W2,S(x) 14 W1,S(x) R2,S(x) W1,S(y) R2,S(y)
  • 15. Concurrency Bugs Technique Studies Conclusion UNICORN: Overview [ Fault-localization technique ] P ranked- UNICORN patterns T 15
  • 16. Concurrency Bugs Technique Studies Conclusion UNICORN: Overview [ UNICORN: A UNIfied approach for localizing non-deadlock COncuRreNcy Bugs ] Find both single-variable and multi-variable patterns pairs, patterns, ranked- P Step 1: Step 2: Step 3: outcomes outcomes patterns Collect Pairs Combine Pairs Rank T Patterns From Executions Into Patterns Intuition: Patterns consist of (one or two) pairs 16
  • 17. Concurrency Bugs Technique Studies Conclusion Problematic Access Patterns #Var Type Memory Access Patterns Memory Access Pairs R1,S(x) W2,S(x) R1,S(x) W2,S(x) Order W1,S(x) R2,S(x) W1,S(x) R2,S(x) W1,S(x) W2,S(x) W1,S(x) W2,S(x) R1,S(x) W2,S(x) R1,S(x) R1,S(x) W2,S(x) W2,S(x) R1,S(x) Single W1,S(x) W2,S(x) R1,S(x) W1,S(x) W2,S(x) W2,S(x) R1,S(x) Single- Variable W1,S(x) R2,S(x) W1,S(x) W1,S(x) R2,S(x) R2,S(x) W1,S(x) Atomicity W1,S(x) R2,S(x) W1,S(x) W1,S(x) R2,S(x) R2,S(x) W1,S(x) W1,S(x) W2,S(x) W1,S(x) W1,S(x) W2,S(x) W2,S(x) W1,S(x) W1,S(x) W2,S(x) W2,S(y) W1,S(y) W1,S(x) W2,S(x) W2,S(y) W1,S(y) W1,S(x) W2,S(y) W2,S(x) W1,S(y) W1,S(x) W2,S(x) W2,S(y) W1,S(y) W1,S(x) W2,S(y) W1,S(y) W2,S(x) W1,S(x) W2,S(x) W2,S(y) W1,S(y) W1,S(x) R2,S(x) R2,S(y) W1,S(y) W1,S(x) R2,S(x) R2,S(y) W1,S(y) Multi- Multi Variable W1,S(x) R2,S(y) R2,S(x) W1,S(y) W1,S(x) R2,S(x) R2,S(y) W1,S(y) Atomicity R1,S(x) W2,S(x) W2,S(y) R1,S(y) R1,S(x) W2,S(x) W2,S(y) R1,S(y) R1,S(x) W2,S(y) W2,S(x) R1,S(y) R1,S(x) W2,S(x) W2,S(y) R1,S(y) R1,S(x) W2,S(y) R1,S(y) W2,S(x) R1,S(x) W2,S(x) W2,S(y) R1,S(y) 17 W1,S(x) R2,S(x) W1,S(y) R2,S(y) W1,S(x) R2,S(x) R2,S(y) W1,S(y)
  • 18. Concurrency Bugs Technique Studies Conclusion Step 1: Collect Pairs in Executions  Collect pairs using sliding window [Falcon, ICSE 2010]  Maintain a window per shared variable (pair window)  Collect WR, RW, WW access-pairs within window pairs, patterns, ranked- P Step 1: Step 2: Step 3: patterns outcomes outcomes Collect Pairs Combine Pairs Rank T Patterns From Executions Into Patterns 18
  • 19. Concurrency Bugs Technique Studies Conclusion Step 1: Collect Pairs in Executions [Run 1] Failing Thread 1 Thread 2 Accesses int delete(…) { int insert(…) { R0 R0 R1 R1 W0 W0 W1 W2 W3 W4 … … Lock(X); Lock(X); W1: Tbl(); W2: Tbl(); Windows Unlock(X); Unlock(X); Tbl: … … … LOG: … Lock(Y); Lock(Y); W4: LOG(); W3: LOG(); Unlock(Y); Unlock(Y); Pairs … … R0-W0, R0-W1, R1-W0, R1-W1 } } R0-W0, R0-W1 W1-W2 pairs for the W3-W4 code in the slide 19
  • 20. Concurrency Bugs Technique Studies Conclusion Step 1: Collect Pairs in Executions Thread 1 Thread 2 int delete(…) { int insert(…) { I R R R R R R Pair D 1 2 3 4 5 6 … … W1 (Tbl)- Lock(X); Lock(X); 1     W2 (Tbl) W1: Tbl(); W2: Tbl(); W3 (LOG)- 2     Unlock(X); Unlock(X); W4 (LOG) … … W2 (Tbl)- 3   Lock(Y); Lock(Y); W1 (Tbl) W4: LOG(); W3: LOG(); W4 (LOG)- 4   W3 (LOG) Unlock(Y); Unlock(Y); F P P F P P … … } } 20
  • 21. Concurrency Bugs Technique Studies Conclusion Step 2: Combine Pairs to Patterns 1. Set pairs to patterns for order violation 2. Combine pairs to patterns using sliding window  Sort pairs in time order  Combine two-pair-based patterns within pattern window pairs, patterns, ranked- P Step 1: Step 2: Step 3: patterns outcomes outcomes Collect Pairs Combine Pairs Rank T Patterns From Executions Into Patterns 21
  • 22. Concurrency Bugs Technique Studies Conclusion Step 2: Combine Pairs to Patterns [Run 1] Failing Thread 1 Thread 2 Pairs Patterns int delete(…) { int insert(…) { R0-W0 R0-W0 … … R0-W1 R0-W1 Lock(X); Lock(X); R0-W0 R0-W0 R0-W1 R0-W1 W1: Tbl(); W2: Tbl(); R1-W0 R1-W0 Unlock(X); Unlock(X); R1-W1 R1-W1 … … R1-W2 R1-W2 R1-W0 R1-W0 Lock(Y); Lock(Y); R1-W1 R1-W1 W4: LOG(); W3: LOG(); R1-W2 R1-W2 Unlock(Y); Unlock(Y); W1-W2 W1-W2 W3-W4 W3-W4 … … } } W1-W2-W3-W4 22
  • 23. Concurrency Bugs Technique Studies Conclusion Step 2: Combine Pairs to Patterns Thread 1 Thread 2 I R R R R R R Pattern D 1 2 3 4 5 6 int delete(…) { int insert(…) { W1 (Tbl)- 1     … … W2 (Tbl) Lock(X); Lock(X); W3 (LOG)- 2     W1: Tbl(); W2: Tbl(); W4 (LOG) Unlock(X); Unlock(X); W2 (Tbl)- 3   W1 (Tbl) … … W4 (LOG)- Lock(Y); Lock(Y); 4   W3 (LOG) W4: LOG(); W3: LOG(); W1 (Tbl)- Unlock(Y); Unlock(Y); 5 W2 (Tbl)-   W3 (LOG)- … … W4 (LOG) } } F P P F P P 23
  • 24. Concurrency Bugs Technique Studies Conclusion Step 3: Rank Patterns  Rank patterns  Compute suspiciousness of patterns Jaccard formula [Abreu07] failed (P) suspiciousness(P) = totalfailed + passed(P) pairs, patterns, ranked- P Step 1: Step 2: Step 3: patterns outcomes outcomes Collect Pairs Combine Pairs Rank T Patterns From Executions Into Patterns 24
  • 25. Concurrency Bugs Technique Studies Conclusion Step 3: Rank Patterns failed (P) suspiciousness(P) = Thread 1 Thread 2 totalfailed + passed(P) int delete(…) { int insert(…) { I R R R R R R Pattern Susp D 1 2 3 4 5 6 … … W1 (Tbl)- Lock(X); Lock(X); 1     0.5 W2 (Tbl) W1: Tbl(); W2: Tbl(); W3 (LOG)- 2     0.5 Unlock(X); Unlock(X); W4 (LOG) … … 3 W2 (Tbl)-   0.0 W1 (Tbl) Lock(Y); Lock(Y); W4 (LOG)- W4: LOG(); W3: LOG(); 4   0.0 W3 (LOG) Unlock(Y); Unlock(Y); W1 (Tbl)- … … W2 (Tbl)- 5   1.0 } } W3 (LOG)- W4 (LOG) F P P F P P 25
  • 26. Concurrency Bugs Technique Studies Conclusion Step 3: Rank Patterns failed (P) suspiciousness(P) = Thread 1 Thread 2 totalfailed + passed(P) int delete(…) { int insert(…) { I R R R R R R Pattern Susp D 1 2 3 4 5 6 … … W1 (Tbl)- Lock(X); Lock(X); 1     0.5 W2 (Tbl) W1: Tbl(); W2: Tbl(); W3 (LOG)- Summary Unlock(X); 2      0.5 Unlock(X); W4 (LOG) … UNICORN… 3 W2 (Tbl)-   0.0 W1 (Tbl) • Lock(Y); Detects Lock(Y); access pairs memory W4 (LOG)- • W4: LOG(); Combines pairs into patterns W3: LOG(); 4 W3 (LOG)    0.0 Unlock(Y); Unlock(Y); • Ranks patterns w.r.t. suspiciousness W1 (Tbl)- … … W2 (Tbl)- 5    1.0 } } W3 (LOG)- W4 (LOG) F P P F P F P P 26
  • 27. Concurrency Bugs Technique Studies Conclusion Empirical Studies  Studies 1. Evaluate effectiveness of the technique 2. Measure distance of the pattern window 3. Evaluate efficiency of the technique (see paper)  Empirical Setup  Implemented in Java (Soot) and C++ (LLVM)  Evaluated on a set of subjects 27
  • 28. Concurrency Bugs Technique Studies Conclusion Subjects Language Program LOC % Failed Bug Type TimerThread 68 14.4 Order LoadScript 110 49.8 Single-variable atomicity MysqlLog 89 2.8 Single-variable atomicity C++ Extracted JsString 95 1.4 Multi-variable atomicity MysqlDelete 103 3.8 Multi-variable atomicity MysqlSlave 94 0.4 Multi-variable atomicity PBZip2 2k 2.8 Order Mysql-791 372k 64.0 Single-variable atomicity C++ Complete Aget 1.2k 49.0 Multi-variable atomicity Mysql-169 334k 63.0 Multi-variable atomicity StringBuffer 1.4k 22.3 Multi-variable atomicity Java Vector 9.5k 7.6 Multi-variable atomicity 28
  • 29. Concurrency Bugs Technique Studies Conclusion Study 1: Effectiveness  Goal  Todetermine how well UNICORN ranks the pattern of the actual bug  Method  Set pair-window size to 5  Set pattern-window size to 100  Ran each subject 100 times and computed suspiciousness and rankings 29
  • 30. Concurrency Bugs Technique Studies Conclusion Study 1: Effectiveness 1 Num of Num of Susp Susp Susp Rank Num of Program Pairs Patterns (Pair 1) (Pair 2) (Pattern) (Bug) Top rank TimerThread 6 7 1.0 - 1.0 1 3 LoadScript 3 4 0.86 1.0 1.0 1 2 MysqlLog 4 5 0.02 1.0 1.0 1 2 JsString 5 8 2 0.04 1.0 1.0 1 3 MysqlDelete 7 1 0.04 0.27 1.0 1 1 MysqlSlave 6 11 0.01 0.66 1.0 31 1 PBZip2 59 333 0.42 - 0.42 1 6 Mysql-791 1082 10936 1.0 0.64 1.0 1 4 Aget 37 94 0.51 0.50 0.70 1 1 Mysql-169 894 9051 0.63 0.63 1.0 1 7 StringBuffer 8 18 0.58 1.0 1.0 1 3 Vector 11 25 1.0 1.0 1.0 1 4 30
  • 31. Concurrency Bugs Technique Studies Conclusion Study 2: Pattern-window size  Goal  Toinvestigate the practicality of the pattern- window size  Method  Computed the distance between the two pairs of the actual concurrency bugs (using data from Study 1)  Computed the median and maximum distances 31
  • 32. Concurrency Bugs Technique Studies Conclusion Study 2: Pattern-window size Num of Num of Median Maximum Program Pairs Patterns distance distance TimerThread 6 7 N/A N/A LoadScript 3 4 2 2 MysqlLog 4 5 2 2 JsString 5 8 3 3 MysqlDelete 7 1 2 2 MysqlSlave 6 11 2 2 PBZip2 59 333 N/A N/A Mysql-791 1082 10936 18 27 Aget 37 94 2 3 Mysql-169 894 9051 41 41 StringBuffer 8 18 4 5 Vector 11 25 2 2 32
  • 33. Concurrency Bugs Technique Studies Conclusion Future Work  Provide information to understand bugs  Problem: Several patterns ranked top together  Approach: In-depth analysis on the ranking  Provide information on test-suite  Problem: No study on effectiveness vs. test suite  Approach: Investigation on quality of test suite  Improve overhead  Problem: Significant overhead on monitoring  Approach: Use techniques such as sampling 33
  • 34. Concurrency Bugs Technique Studies Conclusion Contributions  UNICORN is the first unified technique that  detects memory-access pairs, combines pairs to get patterns, and ranks patterns with respect to suspiciousness  handles both single- and multi-variable violations  Empirical studies show that UNICORN  is effective in identifying patterns associated with real bugs  is efficient  it needs small-/fixed-sized windows to find patterns  its runtime overhead comparable to other techniques Questions 34