Abstract
Futures are an elegant approach to expressing parallelism in functional programs. However, combining futures with imperative programming (as in C++ or in Java) can lead to pernicious bugs in the form of data races and deadlocks, as a consequence of uncontrolled data flow through mutable shared memory.
In this paper we introduce the Known Joins (KJ) property for parallel programs with futures, and relate it to the Deadlock Freedom (DF) and the Data-Race Freedom (DRF) properties. Our paper offers two key theoretical results: 1) DRF implies KJ, and 2) KJ implies DF. These results show that data-race freedom is sufficient to guarantee deadlock freedom in programs with futures that only manipulate unsynchronized shared variables. To the best of our knowledge, these are the first theoretical results to establish sufficient conditions for deadlock freedom in imperative parallel programs with futures, and to characterize the subset of data races that can trigger deadlocks (those that violate the KJ property).
From result 2), we developed a tool that avoids deadlocks in linear time and space when KJ holds, i.e., when there are no data races among references to futures. When KJ fails, the tool reports the data race and optionally falls back to a standard deadlock avoidance algorithm by cycle detection. Our tool verified a dataset of ∼2,300 student’s homework solutions and found one deadlocked program. The performance results obtained from our tool are very encouraging: a maximum slowdown of 1.06× on a 16-core machine, always outperforming deadlock avoidance via cycle-detection. Proofs of the two main results were formalized using the Coq proof assistant.
- Paulo Sérgio Almeida, Carlos Baquero, and Victor Fonte. 2008. Interval Tree Clocks. In OPODIS (LNCS), Vol. 5401. Springer, Article 18, 16 pages. Google Scholar
Digital Library
- Utpal Banerjee, Brian Bliss, Zhiqiang Ma, and Paul Petersen. 2006. A theory of data race detection. In PADTAD. ACM, 69–78. Google Scholar
Digital Library
- Carlos Baquero and Nuno Preguiça. 2016. Why Logical Clocks Are Easy. Commun. ACM 59, 4 (2016), 43–47. Google Scholar
Digital Library
- Kenneth P. Birman and Thomas A. Joseph. 1987. Reliable Communication in the Presence of Failures. Theoretical Computer Science 5, 1 (1987), 47–76. Google Scholar
Digital Library
- Robert D. Blumofe and Charles E. Leiserson. 1998. Space-Efficient Scheduling of Multithreaded Computations. Computing 27, 1 (1998), 202–229. Google Scholar
Digital Library
- Gérard Boudol. 2009. A Deadlock-Free Semantics for Shared Memory Concurrency. In ICTAC (LNCS), Vol. 5684. Springer, 140–154. Google Scholar
Digital Library
- Chandrasekhar Boyapati, Robert Lee, and Martin Rinard. 2002a. Ownership Types for Safe Programming: Preventing Data Races and Deadlocks. In OOPSLA. ACM, 211–230. Google Scholar
Digital Library
- Chandrasekhar Boyapati, Robert Lee, and Martin Rinard. 2002b. Ownership types for safe programming: preventing data races and deadlocks. In OOPSLA. ACM, 211–230. Google Scholar
Digital Library
- Vincent Cavé, Jisheng Zhao, Jun Shirako, and Vivek Sarkar. 2011. Habanero-Java: The New Adventures of Old X10. In PPPJ. ACM, 51–61. Google Scholar
Digital Library
- Philippe Charles, Christian Grothoff, Vijay Saraswat, Christopher Donawa, Allan Kielstra, Kemal Ebcioglu, Christoph von Praun, and Vivek Sarkar. 2005. X10: an object-oriented approach to non-uniform cluster computing. In OOPSLA. ACM, 519–538. Google Scholar
Digital Library
- Tiago Cogumbreiro, Raymond Hu, Francisco Martins, and Nobuko Yoshida. 2015. Dynamic Deadlock Verification for General Barrier Synchronisation. In PPoPP. ACM, 150–160. Google Scholar
Digital Library
- Don Coppersmith and Shmuel Winograd. 1990. Matrix Multiplication via Arithmetic Progressions. Symbolic Computation 9, 3 (1990), 251–280. Google Scholar
Digital Library
- Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. 2009. Introduction to Algorithms (3 rd ed.). MIT.Google Scholar
- Camil Demetrescu and Giuseppe F. Italiano. 2005. Trade-offs for Fully Dynamic Transitive Closure on DAGs: Breaking Through the O(n 2 ) Barrier. JACM 52, 2 (2005), 147–156. Google Scholar
Digital Library
- Edsger W. Dijkstra. 1965. Cooperating Sequential Processes. Technical Report. Technical University of Eindhoven. EWD-123.Google Scholar
- Anne Dinning and Edith Schonberg. 1991. Detecting Access Anomalies in Programs with Critical Sections. In PADD. ACM, 85–96. Google Scholar
Digital Library
- Dawson Engler and Ken Ashcraft. 2003. RacerX: effective, static detection of race conditions and deadlocks. In SOSP. ACM, 237–252. Google Scholar
Digital Library
- Mingdong Feng and Charles E. Leiserson. 1997. Efficient detection of determinacy races in Cilk programs. In SPAA. ACM, 1–11. Google Scholar
Digital Library
- Colin J. Fidge. 1988. Timestamps in Message-Passing Systems that Preserve the Partial Ordering. In ACSC, Vol. 10. University of Queensland, 55–66.Google Scholar
- Cormac Flanagan and Stephen N. Freund. 2009. FastTrack: efficient and precise dynamic race detection. In PLDI. ACM, 121–133. Google Scholar
Digital Library
- Andy Georges, Dries Buytaert, and Lieven Eeckhout. 2007. Statistically Rigorous Java Performance Evaluation. In OOPSLA. ACM, 57–76. Google Scholar
Digital Library
- Prodromos Gerakios, Nikolaos Papaspyrou, Konstantinos Sagonas, and Panagiotis Vekris. 2011. Dynamic Deadlock Avoidance in Systems Code Using Statically Inferred Effects. In PLOS. ACM, Article 5, 5 pages. Google Scholar
Digital Library
- Ok-Kyoon Ha and Yong-Kee Jun. 2015. An Efficient Algorithm for On-the-fly Data Race Detection Using an Epoch-based Technique. Scientific Programming 2015 (2015), 14. Google Scholar
Digital Library
- Robert H. Halstead, Jr. 1985. MULTILISP: A Language for Concurrent Symbolic Computation. Transactions on Programming Languages and Systems 7, 4 (1985), 501–538. Google Scholar
Digital Library
- Tobias Hilbrich, Bronis R. de Supinski, Martin Schulz, and Matthias S. Müller. 2009. A graph based approach for MPI deadlock detection. In ICS. ACM, 296–305. Google Scholar
Digital Library
- Tobias Hilbrich, Joachim Protze, Martin Schulz, Bronis R. de Supinski, and Matthias S. Müller. 2012. MPI runtime error detection with MUST: advances in deadlock detection. In SC. IEEE, Article 30, 11 pages. Google Scholar
Digital Library
- Shams Imam and Vivek Sarkar. 2014. Habanero-Java Library: A Java 8 Framework for Multicore Programming. In PPPJ. ACM, 75–86. Google Scholar
Digital Library
- Shams Imam, Jisheng Zhao, and Vivek Sarkar. 2015. A Composable Deadlock-Free Approach to Object-Based Isolation. In Euro-Par (LNCS), Vol. 9233. Springer, 426–437. Google Scholar
Cross Ref
- Sreekaanth S. Isloor and T. Anthony Marsland. 1980. The Deadlock Problem: An Overview. Computer 13, 9 (1980), 58–78. Google Scholar
Digital Library
- Edgar Knapp. 1987. Deadlock detection in distributed databases. Computing Survey 19, 4 (1987), 303–328. Google Scholar
Digital Library
- Bettina Krammer, Tobias Hilbrich, Valentin Himmler, Blasius Czink, Kiril Dichev, and Matthias S. Müller. 2008. MPI Correctness Checking with Marmot. In PTW. Springer, 61–78. Google Scholar
Cross Ref
- Leslie Lamport. 1978. Time, Clocks, and the Ordering of Events in a Distributed System. Commun. ACM 21, 7 (1978), 558–565. Google Scholar
Digital Library
- Peng Li, Kunal Agrawal, Jeremy Buhler, and Roger D. Chamberlain. 2010. Deadlock Avoidance for Streaming Computations with Filtering. In SPAA. ACM, 243–252. Google Scholar
Digital Library
- Glenn R. Luecke, Hua Chen, James Coyle, Jim Hoekstra, Marina Kraeva, and Yan Zou. 2003. MPI-CHECK: a tool for checking Fortran 90 MPI programs. CCPE 15, 2 (2003), 93–100. Google Scholar
Cross Ref
- Jeremy Manson, William Pugh, and Sarita V. Adve. 2005. The Java Memory Model. In POPL. ACM, 378–391. Google Scholar
Digital Library
- Friedemann Mattern. 1989. Virtual time and global states in distributed systems. In WDAG. North-Holland/Elsevier, 215–226.Google Scholar
- John Mellor-Crummey. 1991. On-the-fly detection of data races for programs with nested fork-join parallelism. In SC. ACM, 24–33. Google Scholar
Digital Library
- Toshimi Minoura. 1982. Deadlock Avoidance Revisited. JACM 29, 4 (1982), 1023–1048. Google Scholar
Digital Library
- Andrey Mokhov and Victor Khomenko. 2014. Algebra of Parameterised Graphs. Transactions on Embedded Computing Systems 13, 4s, Article 143 (2014), 22 pages. Google Scholar
Digital Library
- Ian Munro. 1971. Efficient Determination of the Transitive Closure of a Directed Graph. Inform. Process. Lett. 1, 2 (1971), 56–58. Google Scholar
Digital Library
- V. Krishna Nandivada, Jun Shirako, Jisheng Zhao, and Vivek Sarkar. 2013. A Transformation Framework for Optimizing Task-Parallel Programs. Transactions on Programming Languages and Systems 35, 1, Article 3 (2013), 48 pages. Google Scholar
Digital Library
- Armand Navabi, Xiangyu Zhang, and Suresh Jagannathan. 2008. Quasi-static Scheduling for Safe Futures. In PPoPP. ACM, 23–32. Google Scholar
Digital Library
- Raghavan Raman, Jisheng Zhao, Vivek Sarkar, Martin Vechev, and Eran Yahav. 2012. Efficient data race detection for async-finish parallelism. Formal Methods in System Design 41, 3 (2012), 321–347. Google Scholar
Digital Library
- Veselin Raychev, Martin Vechev, and Manu Sridharan. 2013. Effective Race Detection for Event-driven Programs. In OOPSLA. ACM, 151–166. Google Scholar
Digital Library
- Spiridon A. Reveliotis, Mark A. Lawley, and Placid M. Ferreira. 1997a. Polynomial-complexity deadlock avoidance policies for sequential resource allocation systems. Transactions on Automatic Control 42, 10 (1997), 1344–1357. Google Scholar
Cross Ref
- Spiridon A. Reveliotis, Mark A. Lawley, and Placid M. Ferreira. 1997b. Polynomial-complexity deadlock avoidance policies for sequential resource allocation systems. Transactions on Automatic Control 42, 10 (1997), 1344–1357. Google Scholar
Cross Ref
- Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, and Thomas Anderson. 1997. Eraser: A Dynamic Data Race Detector for Multithreaded Programs. Transactions on Computer Systems 15, 4 (1997), 391–411. Google Scholar
Digital Library
- Reinhard Schwarz and Friedemann Mattern. 1994. Detecting Causal Relationships in Distributed Computations: In Search of the Holy Grail. Distributed Computing 7, 3 (1994), 149–174. Google Scholar
Digital Library
- Jun Shirako, David M. Peixotto, Vivek Sarkar, and William N. Scherer. 2008. Phasers: a unified deadlock-free construct for collective and point-to-point synchronization. In ICS. ACM, 277–288. Google Scholar
Digital Library
- Lorna A. Smith, J. Mark Bull, and Jan Obdrzálek. 2001. A Parallel Java Grande Benchmark Suite. In SC. ACM, 10. Google Scholar
Digital Library
- Rishi Surendran and Vivek Sarkar. 2016. Dynamic Determinacy Race Detection for Task Parallelism with Futures. In RV (LNCS), Vol. 10012. Springer, 368–385. Google Scholar
Cross Ref
- Raja Vallée-Rai, Phong Co, Etienne Gagnon, Laurie Hendren, Patrick Lam, and Vijay Sundaresan. 1999. Soot - a Java Bytecode Optimization Framework. In CASCON. IBM, Article 13, 160–170 pages.Google Scholar
- Philippe Virouleau, Pierrick Brunet, François Broquedis, Nathalie Furmento, Samuel Thibault, Olivier Aumage, and Thierry Gautier. 2014. Evaluation of OpenMP Dependent Tasks with the KASTORS Benchmark Suite. In IWOMP (LNCS), Vol. 8766. Springer, 16–29. Google Scholar
Cross Ref
- Anh Vo. 2011. Scalable Formal Dynamic Verification of MPI Programs Through Distributed Causality Tracking. Ph.D. Dissertation. University of Utah. Advisor(s) Gopalakrishnan, Ganesh. AAI3454168.Google Scholar
Digital Library
- Adam Welc, Suresh Jagannathan, and Antony Hosking. 2005. Safe Futures for Java. In OOPSLA. ACM, 439–453. Google Scholar
Digital Library
- Amy Williams, William Thies, and Michael D. Ernst. 2005. Static Deadlock Detection for Java Libraries. In ECOOP (LNCS), Vol. 3586. Springer, 602–629. Google Scholar
Digital Library
Index Terms
Deadlock avoidance in parallel programs with futures: why parallel tasks should not wait for strangers
Recommendations
Automatic repair for multi-threaded programs with Deadlock/Livelock using maximum satisfiability
ISSTA 2014: Proceedings of the 2014 International Symposium on Software Testing and AnalysisDeadlock-freedom is a major challenge in developing multi-threaded programs, as a deadlock cannot be resolved until one restarts the program (mostly by using manual intervention). To avoid the risk of blocking, a program may use the trylock operations ...
Efficient distributed deadlock avoidance with liveness guarantees
EMSOFT '06: Proceedings of the 6th ACM & IEEE International conference on Embedded softwareWe present a deadlock avoidance algorithm for distributed systems that guarantees liveness. Deadlock avoidance in distributed systems is a hard problem and general solutions are considered impractical due to the high communication overhead. In previous ...
Jthread, a deadlock-free mutex library
PPDP '15: Proceedings of the 17th International Symposium on Principles and Practice of Declarative ProgrammingWe design a mutex library for Hop -- a dialect of Scheme which supports preemptive multithreading and shared memory -- that mixes deadlock prevention and deadlock avoidance to provide an easy to use, expressive, and safe locking function. This requires ...






Comments