Skip to main content

Effectively Recognize Ad hoc Synchronizations with Static Analysis

  • Conference paper
  • First Online:
Languages and Compilers for Parallel Computing (LCPC 2013)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8664))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 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. 2.

    Program order is the order among statements statically specified in the source code.

  3. 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. 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. 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. 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. 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

  1. Adve, S.V., Hill, M.D.: Weak ordering - a new definition. In: ISCA, pp. 2–14 (1990)

    Google Scholar 

  2. Andersen, L.O.: Program analysis and specialization for the C programming language. Ph.D thesis, DIKU, University of Copenhagen, May 1994

    Google Scholar 

  3. Lee, K., Midkiff, S.P.: A two-phase escape analysis for parallel Java programs. In: PACT, pp. 53–62 (2006)

    Google Scholar 

  4. Jannesari, A., Tichy, W.F.: Identifying ad-hoc synchronization for enhanced race detection. In: IPDPS. IEEE (2010)

    Google Scholar 

  5. Krena, B., Letko, Z., Tzoref, R., Ur, S., Vojnar, T.: Healing data races on-the-fly. In: PADTAD, pp. 54–64 (2007)

    Google Scholar 

  6. O’Callahan, R., Choi, J.-D.: Hybrid dynamic data race detection. In: PPoPP, pp. 167–178 (2003)

    Google Scholar 

  7. Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann Publisher, San Francisco (1997)

    Google Scholar 

  8. Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: POPL, pp. 378–391 (2005)

    Google Scholar 

  9. Naik, M., Aiken, A., Whaley, J.: Effective static race detection for Java. In: PLDI, pp. 308–319 (2006)

    Google Scholar 

  10. von Praun, C., Gross, T.R.: Object race detection. In: OOPSLA, pp. 70–82 (2001)

    Google Scholar 

  11. Perkovic, D., Keleher, P.J.: Online data-race detection via coherency guarantees. In: OSDI, pp. 47–57 (1996)

    Google Scholar 

  12. 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)

    Google Scholar 

  13. Tian, C., Nagarajan, V., Gupta, R., Tallam, S.: Dynamic recognition of synchronization operations for improved data race detection. In: ISSTA, pp. 143–154 (2008)

    Google Scholar 

  14. Xiong, W., Park, S., Zhang, J., Zhou, Y., Ma, Z.: Ad hoc synchronization considered harmful. In: OSDI, pp. 1–8 (2010)

    Google Scholar 

  15. Xie, X., Xue, J.: ACCULOCK: accurate and efficient detection of data races. In: CGO, pp. 201–212 (2011)

    Google Scholar 

  16. Subsection 8.3.1.4 in The Java Language Specification, Third Edition. http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html

  17. Java grande benchmark. http://www.epcc.ed.ac.uk/research/java-grande/

  18. Raja raytracer program. http://raja.sourceforge.net/

  19. SPEC2000 Java Business Benchmark. http://www.spec.org/osg/jbb2000/

  20. JTPCC TPC-C benchmark. http://jtpcc.sourceforge.net/

  21. Dacapo Benchmarks. http://dacapobench.org/

  22. W3C web server jigsaw. http://www.w3.org/Jigsaw/

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Le Yin .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics