TY - GEN
T1 - Thread contracts for safe parallelism
AU - Karmani, Rajesh K.
AU - Madhusudan, P.
AU - Moore, Brandon M.
PY - 2011
Y1 - 2011
N2 - We build a framework of thread contracts, called Accord, that allows programmers to annotate their concurrency co-ordination strategies. Accord annotations allow programmers to declaratively specify the parts of memory that a thread may read or write into, and the locks that protect them, reflecting the concurrency co-ordination among threads and the reason why the program is free of data-races. We provide automatic tools to check if the concurrency co-ordination strategy ensures race-freedom, using constraint-solvers (SMT solvers). Hence programmers using Accord can both formally state and prove their co-ordination strategies ensure race freedom. The programmer's implementation of the co-ordination strategy may however be correct or incorrect. We show how the formal Accord contracts allow us to automatically insert runtime assertions that serve to check, during testing, whether the implementation conforms to the contract. Using a large class of data-parallel programs that share memory in intricate ways, we show that natural and simple contracts suffice to document the co-ordination strategy amongst threads, and that the task of showing that the strategy ensures race-freedom can be handled efficiently and automatically by an existing SMT solver (Z3). While co-ordination strategies can be proved race-free in our framework, failure to prove the co-ordination strategy race-free, accompanied by counter-examples produced by the solver, indicates the presence of races. Using such counterexamples, we report hitherto undiscovered data-races that we found in the long-tested applu-l benchmark in the Spec OMP2001 suite.
AB - We build a framework of thread contracts, called Accord, that allows programmers to annotate their concurrency co-ordination strategies. Accord annotations allow programmers to declaratively specify the parts of memory that a thread may read or write into, and the locks that protect them, reflecting the concurrency co-ordination among threads and the reason why the program is free of data-races. We provide automatic tools to check if the concurrency co-ordination strategy ensures race-freedom, using constraint-solvers (SMT solvers). Hence programmers using Accord can both formally state and prove their co-ordination strategies ensure race freedom. The programmer's implementation of the co-ordination strategy may however be correct or incorrect. We show how the formal Accord contracts allow us to automatically insert runtime assertions that serve to check, during testing, whether the implementation conforms to the contract. Using a large class of data-parallel programs that share memory in intricate ways, we show that natural and simple contracts suffice to document the co-ordination strategy amongst threads, and that the task of showing that the strategy ensures race-freedom can be handled efficiently and automatically by an existing SMT solver (Z3). While co-ordination strategies can be proved race-free in our framework, failure to prove the co-ordination strategy race-free, accompanied by counter-examples produced by the solver, indicates the presence of races. Using such counterexamples, we report hitherto undiscovered data-races that we found in the long-tested applu-l benchmark in the Spec OMP2001 suite.
KW - Concurrent contracts
KW - Constraint solvers
KW - Data-races
KW - Testing
UR - http://www.scopus.com/inward/record.url?scp=79952835146&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=79952835146&partnerID=8YFLogxK
U2 - 10.1145/1941553.1941573
DO - 10.1145/1941553.1941573
M3 - Conference contribution
AN - SCOPUS:79952835146
SN - 9781450301190
T3 - Proceedings of the ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP
SP - 125
EP - 134
BT - PPoPP'11 - Proceedings of the 2011 ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming
T2 - 16th ACM Symposium on Principles and Practice of Parallel Programming, PPoPP'11
Y2 - 12 February 2011 through 16 February 2011
ER -