Efficient computation of happens-before relation for event-driven programs

An emerging style of programming is to use both threads and events to achieve better scalability. The improved scalability comes at the price of increased complexity, as both threads and events can follow non-deterministic schedules. The happens-before (HB) relation captures the space of possible schedules and forms the basis of various concurrency analyses. Improving efficiency of the HB computation can speed up these analyses. In this paper, we identify a major bottleneck in computation of the HB relation for such event-driven programs. Event-driven programs are designed to interact continuously with their environment, and usually receive a large number of events even within a short span of time. This increases the cost of discovering the HB order among the events. We propose a novel data structure, called event graph, that maintains a subset of the HB relation to efficiently infer order between any pair of events. We present an algorithm, called EventTrack, which improves efficiency of vector clock based HB computation for event-driven programs using event graphs. We have implemented EventTrack and evaluated it on traces of eight Android applications. Compared to the state-of-the-art technique, EventTrack gave an average speedup of 4.9X. The speedup ranged from 1.8X to 10.3X across the applications.

[1]  Swarnendu Biswas,et al.  DoubleChecker: efficient sound and precise atomicity checking , 2014, PLDI.

[2]  Yannis Smaragdakis,et al.  Sound predictive race detection in polynomial time , 2012, POPL '12.

[3]  Dimitar Dimitrov,et al.  Stateless model checking of event-driven applications , 2015, OOPSLA.

[4]  Marsha Chechik,et al.  Proceedings of the 22nd International Conference on Tools and Algorithms for the Construction and Analysis of Systems - Volume 9636 , 2016 .

[5]  Aditya Kanade,et al.  Efficient race detection in the presence of programmatic event loops , 2016, ISSTA.

[6]  Manu Sridharan,et al.  Effective race detection for event-driven programs , 2013, OOPSLA.

[7]  H. V. Jagadish,et al.  A compression technique to materialize transitive closure , 1990, TODS.

[8]  Stephen N. Freund,et al.  Velodrome: a sound and complete dynamic atomicity checker for multithreaded programs , 2008, PLDI '08.

[9]  Satish Narayanasamy,et al.  Race detection for event-driven mobile applications , 2014, PLDI.

[10]  Satish Narayanasamy,et al.  Detecting and surviving data races using complementary schedules , 2011, SOSP.

[11]  Jong-Deok Choi,et al.  Hybrid dynamic data race detection , 2003, PPoPP '03.

[12]  Marsha Chechik,et al.  Tools and Algorithms for the Construction and Analysis of Systems , 2016, Lecture Notes in Computer Science.

[13]  Assaf Schuster,et al.  Efficient on-the-fly data race detection in multithreaded C++ programs , 2003, PPoPP '03.

[14]  Leslie Lamport,et al.  Time, clocks, and the ordering of events in a distributed system , 1978, CACM.

[15]  Yongjian Hu,et al.  Automatically verifying and reproducing event-based races in Android apps , 2016, ISSTA.

[16]  Aditya Kanade,et al.  Correctness Proofs and Complexity Analysis of EventTrack Algorithm , 2017 .

[17]  Koen De Bosschere,et al.  TRaDe: A Topological Approach to On-the-Fly Race Detection in Java Programs , 2001, Java Virtual Machine Research and Technology Symposium.

[18]  Martin T. Vechev,et al.  Scalable race detection for Android applications , 2015, OOPSLA.

[19]  Satish Narayanasamy,et al.  AsyncClock: Scalable Inference of Asynchronous Event Causality , 2017, ASPLOS.

[20]  Stephen N. Freund,et al.  FastTrack: efficient and precise dynamic race detection , 2009, PLDI '09.

[21]  Friedemann Mattern,et al.  Virtual Time and Global States of Distributed Systems , 2002 .

[22]  Masumi Nakamura,et al.  Programming Android , 2011 .

[23]  Rupak Majumdar,et al.  Race detection for Android applications , 2014, PLDI.

[24]  Rupak Majumdar,et al.  Partial Order Reduction for Event-Driven Multi-threaded Programs , 2016, TACAS.

[25]  Manu Sridharan,et al.  Race detection for web applications , 2012, PLDI.