ABSTRACT
Deadlocks, in which threads wait on each other in a cyclic fashion and can't make progress, have plagued parallel programs for decades. In recent years, as the parallel programming mechanism known as futures has gained popularity, interest in preventing deadlocks in programs with futures has increased as well. Various static and dynamic algorithms exist to detect and prevent deadlock in programs with futures, generally by constructing some approximation of the dependency graph of the program but, as far as we are aware, all are specialized to a particular programming language.
A recent paper introduced graph types, by which one can statically approximate the dependency graphs of a program in a language-independent fashion. By analyzing the graph type directly instead of the source code, a graph-based program analysis, such as one to detect deadlock, can be made language-independent. Indeed, the paper that proposed graph types also proposed a deadlock detection algorithm. Unfortunately, the algorithm was based on an unproven conjecture which we show to be false. In this paper, we present, and prove sound, a type system for finding possible deadlocks in programs that operates over graph types and can therefore be applied to many different languages. As a proof of concept, we have implemented the algorithm over a subset of the OCaml language extended with built-in futures.
- [n.d.]. The Rust language. https://www.rust-lang.org. Accessed: 2023-07-07.Google Scholar
- Michael A. Bender, Jeremy T. Fineman, Seth Gilbert, and Charles E. Leiserson. 2004. On-the-Fly Maintenance of Series-Parallel Relationships in Fork-Join Multithreaded Programs (SPAA '04). Association for Computing Machinery, New York, NY, USA, 133--144. Google ScholarDigital Library
- Guy E. Blelloch and Margaret Reid-Miller. 1997. Pipelining with Futures. In Proceedings of the Ninth Annual ACM Symposium on Parallel Algorithms and Architectures (Newport, Rhode Island, USA) (SPAA '97). Association for Computing Machinery, New York, NY, USA, 249--259. Google ScholarDigital Library
- Gérard Boudol. 2009. A Deadlock-Free Semantics for Shared Memory Concurrency. In Theoretical Aspects of Computing - ICTAC 2009, Martin Leucker and Carroll Morgan (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 140--154.Google ScholarDigital Library
- Chandrasekhar Boyapati, Robert Lee, and Martin Rinard. 2002. Ownership Types for Safe Programming: Preventing Data Races and Deadlocks. In Proceedings of the 17th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (Seattle, Washington, USA) (OOPSLA '02). Association for Computing Machinery, New York, NY, USA, 211--230. Google ScholarDigital Library
- Vincent Cavé, Jisheng Zhao, Jun Shirako, and Vivek Sarkar. 2011. Habanero-Java: The New Adventures of Old X10. In Proceedings of the 9th International Conference on Principles and Practice of Programming in Java (Kongens Lyngby, Denmark) (PPPJ '11). Association for Computing Machinery, New York, NY, USA, 51--61. Google ScholarDigital Library
- E. G. Coffman, M. Elphick, and A. Shoshani. 1971. System Deadlocks. ACM Comput. Surv. 3, 2 (Jun 1971), 67--78. Google ScholarDigital Library
- Tiago Cogumbreiro, Rishi Surendran, Francisco Martins, Vivek Sarkar, Vasco T. Vasconcelos, and Max Grossman. 2017. Deadlock Avoidance in Parallel Programs with Futures: Why Parallel Tasks Should Not Wait for Strangers. Proc. ACM Program. Lang. 1, OOPSLA, Article 103 (Oct. 2017), 26 pages. Google ScholarDigital Library
- Dawson Engler and Ken Ashcraft. 2003. RacerX: Effective, Static Detection of Race Conditions and Deadlocks. In Proceedings of the Nineteenth ACM Symposium on Operating Systems Principles (Bolton Landing, NY, USA) (SOSP '03). Association for Computing Machinery, New York, NY, USA, 237--252. Google ScholarDigital Library
- Matteo Frigo, Charles E. Leiserson, and Keith H. Randall. 1998. The Implementation of the Cilk-5 Multithreaded Language. In Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation (Montreal, Quebec, Canada) (PLDI '98). Association for Computing Machinery, New York, NY, USA, 212--223. Google ScholarDigital Library
- Robert H. Halstead. 1985. MULTILISP: a language for concurrent symbolic computation. ACM Transactions on Programming Languages and Systems 7 (1985), 501--538. Google ScholarDigital Library
- Maurice Herlihy and Zhiyu Liu. 2014. Well-Structured Futures and Cache Locality. In Proceedings of the 19th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (Orlando, Florida, USA) (PPoPP '14). Association for Computing Machinery, New York, NY, USA, 155--166. Google ScholarDigital Library
- Stephen P. Masticola. 1993. Static Detection of Deadlocks in Polynomial Time. Ph.D. Dissertation. USA. UMI Order No. GAX93-33428.Google Scholar
- Stefan K. Muller. 2022. Static Prediction of Parallel Computation Graphs. Proc. ACM Program. Lang. 6, POPL, Article 46 (Jan 2022), 31 pages. Google ScholarDigital Library
- Stefan K Muller. 2023. Language-Agnostic Static Deadlock Detection for Futures. Google ScholarDigital Library
- Alan Mycroft. 1984. Polymorphic type schemes and recursive definitions. In International Symposium on Programming, M. Paul and B. Robinet (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 217--228. Google ScholarCross Ref
- Mayur Naik, Chang-Seo Park, Koushik Sen, and David Gay. 2009. Effective static deadlock detection. In 2009 IEEE 31st International Conference on Software Engineering. 386--396. Google ScholarDigital Library
- K. C. Sivaramakrishnan, Stephen Dolan, Leo White, Sadiq Jaffer, Tom Kelly, Anmol Sahoo, Sudha Parimala, Atul Dhiman, and Anil Madhavapeddy. 2020. Retrofitting parallelism onto OCaml. Proc. ACM Program. Lang. 4, ICFP (2020), 113:1--113:30. Google ScholarDigital Library
- Vasco T. Vasconcelos, Francisco Martins, and Tiago Cogumbreiro. 2010. Type Inference for Deadlock Detection in a Multithreaded Polymorphic Typed Assembly Language. Electronic Proceedings in Theoretical Computer Science 17 (feb 2010), 95--109. Google ScholarCross Ref
- Caleb Voss, Tiago Cogumbreiro, and Vivek Sarkar. 2019. Transitive Joins: A Sound and Efficient Online Deadlock-Avoidance Policy (PPoPP '19). Association for Computing Machinery, New York, NY, USA, 378--390. Google ScholarDigital Library
- Caleb Voss and Vivek Sarkar. 2021. An Ownership Policy and Deadlock Detector for Promises. In Proceedings of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (Virtual Event, Republic of Korea) (PPoPP '21). Association for Computing Machinery, New York, NY, USA, 348--361. Google ScholarDigital Library
- Amy Williams, William Thies, and Michael D. Ernst. 2005. Static Deadlock Detection for Java Libraries. In ECOOP 2005 - Object-Oriented Programming, Andrew P. Black (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 602--629.Google Scholar
- Yifan Xu, Kyle Singer, and I-Ting Angelina Lee. 2020. Parallel Determinacy Race Detection for Futures. In Proceedings of the 25th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (San Diego, California) (PPoPP '20). Association for Computing Machinery, New York, NY, USA, 217--231. Google ScholarDigital Library
Index Terms
- Language-Agnostic Static Deadlock Detection for Futures
Recommendations
Compositional deadlock detection for rendezvous communication
EMSOFT '09: Proceedings of the seventh ACM international conference on Embedded softwareConcurrent programming languages are growing in importance with the advent of multi-core systems. However, concurrent programs suffer from problems, such as data races and deadlock, absent from sequential programs. Unfortunately, traditional race and ...
Static lock capabilities for deadlock freedom
TLDI '12: Proceedings of the 8th ACM SIGPLAN workshop on Types in language design and implementationWe present a technique --- lock capabilities --- for statically verifying that multithreaded programs with locks will not deadlock. Most previous work on deadlock prevention requires a strict total order on all locks held simultaneously by a thread, but ...
Pipelines and Beyond: Graph Types for ADTs with Futures
Parallel programs are frequently modeled as dependency or cost graphs, which can be used to detect various bugs, or simply to visualize the parallel structure of the code. However, such graphs reflect just one particular execution and are typically ...
Comments