Lock allocation

  • Authors:
  • Michael Emmi;Jeffrey S. Fischer;Ranjit Jhala;Rupak Majumdar

  • Affiliations:
  • UC Los Angeles;UC Los Angeles;UC San Diego;UC Los Angeles

  • Venue:
  • Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.