Lock allocation
Michael Emmi, Jeffrey S. Fischer, Ranjit Jhala et al. · ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL) · 2007
We introduce lock allocation, an automatic technique that takes a multi-threaded program annotated with atomic sections (that must be executed atomically), and infers a lock assignment from global variables to locks and a lock instrumentation that determines where each lock should be acquired and released such that the resulting instrumented program is guaranteed to preserve atomicity and deadlock freedom (provided all shared state is accessed only within atomic sections). Our algorithm works in the presence of pointers and procedures, and sets up the lock allocation problem as a 0-1 ILP which minimizes the conflict cost between atomic sections while simultaneously minimizing the number of locks. We have implemented our algorithm for both C with pthreads and Java, and have applied it to infer locks in 15K lines of AOLserver code. Our automatic allocation produces the same results as hand annotations for most of this code, while solving the optimization instances within a second for most programs.
Cited by 56 works. doi:10.1145/1190216.1190260
Authors
References
- The model checker SPIN
- Eraser
- Type-based race detection for Java
- Language support for lightweight transactions
- Process structuring, synchronization, and recovery using atomic actions
- A type and effect system for atomicity
- AtomCaml
- Autolocker
- Type inference for atomicity
- Optimistic Concurrency Semantics for Transactions in Coordination Languages