Abstract
Ad hoc synchronizations are ubiquitous in multi-threaded programs. They can cause data race detection tools to report a lot of false warnings. The existing tools for automatically recognizing ad hoc synchronizations limit their recognizing patterns to spin loops. In this paper for the first time we give a formal definition of ad hoc synchronization. Based on the definition we have implemented a static analysis to recognize them. Compared with the best existing analysis tool, the static analysis we have proposed has the same capability of recognizing spin loop synchronizations; in addition to that, the analysis can recognize ad hoc synchronizations which do not belong to the spin loop pattern. We have applied the analysis to a suite of middle scale multi-threaded Java programs. The experiment shows the analysis is effective and fast.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
We have checked the data races reported by Chord manually and verified that no spinning-based ad hoc synchronization in those data races is missed by our analysis.
- 2.
Program order is the order among statements statically specified in the source code.
- 3.
\(\sim \) is an equivalence relation in \(\mathbb {R}\). \(\mathbb {R}_{sp}\) is a subset of \(\mathbb {R}\), so \(\sim \) is also an equivalence relation in \(\mathbb {R}_{sp}\).
- 4.
Here we can not use the criterion that all conflicting accesses are under the guard of the same lock to judge the program is data-race-free. For example, in Fig. 2(a) W\(^1_X\) and R\(^2_X\) are not guarded by any lock, but they are synchronized by the spin loop. The same is true of the accesses of data in Fig. 2(b).
- 5.
Only thread-escape entities, which are accessed by multiple threads, will be involved in the computation of the come from sets, because an object which is local to some thread has nothing to do with communications among threads.
- 6.
Chord can not process dynamic class loading in Java, which is used by jbb, avrora and jigsaw. We modified these programs to make them analyzable to Chord.
- 7.
There are five statements of ‘if (mode==RECORDING)’ in the loop, only one of which is showed in Fig. 6(a) because of space limit.
References
Adve, S.V., Hill, M.D.: Weak ordering - a new definition. In: ISCA, pp. 2–14 (1990)
Andersen, L.O.: Program analysis and specialization for the C programming language. Ph.D thesis, DIKU, University of Copenhagen, May 1994
Lee, K., Midkiff, S.P.: A two-phase escape analysis for parallel Java programs. In: PACT, pp. 53–62 (2006)
Jannesari, A., Tichy, W.F.: Identifying ad-hoc synchronization for enhanced race detection. In: IPDPS. IEEE (2010)
Krena, B., Letko, Z., Tzoref, R., Ur, S., Vojnar, T.: Healing data races on-the-fly. In: PADTAD, pp. 54–64 (2007)
O’Callahan, R., Choi, J.-D.: Hybrid dynamic data race detection. In: PPoPP, pp. 167–178 (2003)
Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann Publisher, San Francisco (1997)
Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: POPL, pp. 378–391 (2005)
Naik, M., Aiken, A., Whaley, J.: Effective static race detection for Java. In: PLDI, pp. 308–319 (2006)
von Praun, C., Gross, T.R.: Object race detection. In: OOPSLA, pp. 70–82 (2001)
Perkovic, D., Keleher, P.J.: Online data-race detection via coherency guarantees. In: OSDI, pp. 47–57 (1996)
Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., Anderson, T.: Eraser: a dynamic data race detector for multi-threaded programs. In: SOSP, pp. 27–37 (1997)
Tian, C., Nagarajan, V., Gupta, R., Tallam, S.: Dynamic recognition of synchronization operations for improved data race detection. In: ISSTA, pp. 143–154 (2008)
Xiong, W., Park, S., Zhang, J., Zhou, Y., Ma, Z.: Ad hoc synchronization considered harmful. In: OSDI, pp. 1–8 (2010)
Xie, X., Xue, J.: ACCULOCK: accurate and efficient detection of data races. In: CGO, pp. 201–212 (2011)
Subsection 8.3.1.4 in The Java Language Specification, Third Edition. http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html
Java grande benchmark. http://www.epcc.ed.ac.uk/research/java-grande/
Raja raytracer program. http://raja.sourceforge.net/
SPEC2000 Java Business Benchmark. http://www.spec.org/osg/jbb2000/
JTPCC TPC-C benchmark. http://jtpcc.sourceforge.net/
Dacapo Benchmarks. http://dacapobench.org/
W3C web server jigsaw. http://www.w3.org/Jigsaw/
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Yin, L. (2014). Effectively Recognize Ad hoc Synchronizations with Static Analysis. In: Cașcaval, C., Montesinos, P. (eds) Languages and Compilers for Parallel Computing. LCPC 2013. Lecture Notes in Computer Science(), vol 8664. Springer, Cham. https://doi.org/10.1007/978-3-319-09967-5_11
Download citation
DOI: https://doi.org/10.1007/978-3-319-09967-5_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-09966-8
Online ISBN: 978-3-319-09967-5
eBook Packages: Computer ScienceComputer Science (R0)