



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




CMPSCI 691W Parallel and Concurrent Programming Spring 2006
Lecturer: Emery Berger Scribe: Heather Conboy
Atomicity is a correctness property of multithreaded programs that guarantees that concurrent threads do not interfere with atomic methods (and/or blocks). This means that the atomic methods (and/or blocks) can be reasoned about in a sequential manner without having to consider all possible thread interleavings. This makes it easier to reason about the behavior and correctness of these programs which simplifies code inspection, testing, and verification. It is possible to check for atomicity using techniques such as static analysis, dynamic analysis, and finite state verification.
Data race freedom: A race condition occurs when two threads simultaneously access the same data variable, and at least one of the accesses is a write [7].
As a correctness property, the above is not sufficient nor necessary.
Atomicity: A method (or block) is atomic if for every arbitrarily interleaved program execution, there exists an equivalent execution with the same overall behavior where the method (or block) is executed serially [1]
Linearizability: A concurrent program is linearizable if each object is linearizable. This correctness property is non-blocking and local. [4]
Serializability: In databases, A concurrent schedule is serializable if it is equivalent to one in which trans- actions appear to execute using a sequential schedule. This correctness property is blocking and global. [6]
As correctness properties, the above three provide stronger guarantees than data race freedom and still allow a great deal of parallelism.
Atomizer is a dynamic atomicity checker that for all methods and/or blocks specified as atomic by either:
9-2 Lecture 9: March 8
detects and reports any atomicity violations.
More specifically, the tool inputs a multithreaded Java program, generates the corresponding instrumented multithreaded Java program that uses dynamic analysis to:
and outputs any atomicity violations with program executions that display the undesired behaviors.
The Lockset algorithm is used for data race detection.
For each allocated object, for each field track to what degree it has been shared among threads:
Thread Local
Shared Modified Shared Read
Thread Local (2)
first thread r/w second thread r/w
second thread r/w
any thread r/w
any thread w
any thread r
other thread r other thread w
Figure 9.1: Thread sharing degree
Figure 9.
If a field is thread local, thread local (2), or shared read, then any access is considered not racy. But if a field is shared modified then its protecting lock set must be inferred.
Version 1:
Each field has a protecting lock set inferred. If an access occurs when the lock set is empty then the access is considered racy.
9-4 Lecture 9: March 8
The Atomizer was evaluated on 12 multithreaded Java programs gathered from various benchmarks.
It used the heuristic to specify methods and/or blocks as atomic. Generally, it appears that programmers often do code to this style of concurrency. The benchmarks for the most part used it.
In summary:
A static type system takes as input a multithreaded program where the programmer must specify:
and outputs whether or not the atomicity is violated.
Evaluation of the static type systems:
See [2].
A finite state verifier takes as input a multithreaded program and perhaps the corresponding sequential program and outputs whether or not the atomicity is violated.
Evaluation of the finite state verifiers:
Lecture 9: March 8 9-
See [3].
[1] C. Flanagan and S.N. Freund. Atomizer: A dynamic atomicity checker for multithreaded programs. In Proc. of the ACM Symposium on Principles of Programming Languages (POPL). ACM Press, 2004.
[2] C. Flanagan and S. Qadeer. A type and effect system for atomicity. In Proc. of the ACM Conference on Programming Language Design and Implementation, pages 338–349, 2003.
[3] J. Hatcliff, Robby, and M.B. Dwyer. Verifying atomicity specifications for concurrent object-oriented software using model-checking. In Proc. of the International Conference on Verification, Model Checking and Abstract Interpretation, 2004.
[4] M.P. Herlihy and J.M. Wing. Linearizability: A correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems, 12(3):463–492, 1990.
[5] R.J. Lipton. Reduction: A method of proving properties of parallel programs. Communications of the ACM, 18(12):717–721, 1975.
[6] C. Papadimitriou. The theory of database concurrency control. Computer Science Press, 1986.
[7] S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T.E. Anderson. Eraser: A dynamic data race detector for multi-threaded programs. ACM Transactions on Computer Systems, 15(4):391–411, 1997.