skip to main content
research-article
Free Access

Don’t Sit on the Fence: A Static Analysis Approach to Automatic Fence Insertion

Published:29 May 2017Publication History
Skip Abstract Section

Abstract

Modern architectures rely on memory fences to prevent undesired weakenings of memory consistency. As the fences’ semantics may be subtle, the automation of their placement is highly desirable. But precise methods for restoring consistency do not scale to deployed systems’ code. We choose to trade some precision for genuine scalability: our technique is suitable for large code bases. We implement it in our new musketeer tool and report experiments on more than 700 executables from packages found in Debian GNU/Linux 7.1, including memcached with about 10,000 LoC.

References

  1. Parosh Aziz Abdulla, Mohamed Faouzi Atig, Yu-Fang Chen, Carl Leonardsson, and Ahmed Rezine. 2013. Memorax, A precise and sound tool for automatic fence insertion under TSO. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS’13) (LNCS). Springer, 530--536. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Parosh Aziz Abdulla, Mohamed Faouzi Atig, Magnus Lang, and Tuan Phong Ngo. 2015. Precise and sound automatic fence insertion procedure under PSO. In International Conference on Networked Systems (NETYS’15).Google ScholarGoogle ScholarCross RefCross Ref
  3. Parosh Aziz Abdulla, Mohamed Faouzi Atig, and Tuan-Phong Ngo. 2015. The best of both worlds: Trading efficiency and optimality in fence insertion for TSO. In European Symposium on Programming on Programming (ESOP’15). Springer, 308--332. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Sarita V. Adve and Kourosh Gharachorloo. 1995. Shared memory consistency models: A tutorial. IEEE Comput. 29, 12 (1995), 66--76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jade Alglave, Daniel Kroening, John Lugton, Vincent Nimal, and Michael Tautschnig. 2011. Soundness of data flow analyses for weak memory models. In Programming Languages and Systems (APLAS’11) (LNCS), Vol. 7078. Springer, 272--288. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jade Alglave, Daniel Kroening, Vincent Nimal, and Michael Tautschnig. 2013. Software verification for weak memory via program transformation. In European Symposium on Programming (ESOP’13) (LNCS). Springer, 512--532. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jade Alglave and Luc Maranget. 2011. Stability in weak memory models. In Computer Aided Verification (CAV’11) (LNCS), Vol. 6806. Springer, 50--66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Jade Alglave, Luc Maranget, S. Sarkar, and Peter Sewell. 2010. Fences in weak memory models. In Computer Aided Verification (CAV’10) (LNCS), Vol. 6174. Springer, 258--272. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Jade Alglave, Luc Maranget, and Michael Tautschnig. 2014. Herding cats: Modelling, simulation, testing, and data mining for weak memory. ACM Trans. Program. Lang. Syst. 36, 2, Article 7 (July 2014), 74 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. John Bender, Mohsen Lesani, and Jens Palsberg. 2015. Declarative fence insertion. In Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’15). ACM, 367--385. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Ahmed Bouajjani, Egor Derevenetc, and Roland Meyer. 2013. Checking and enforcing robustness against TSO. In European Symposium on Programming (ESOP’13) (LNCS), Vol. 7792. Springer, 533--553. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Ahmed Bouajjani, R. Meyer, and E. Moehlmann. 2011. Deciding robustness against total store ordering. In Automata, Languages and Programming (ICALP’11) (LNCS), Vol. 6756. Springer, 428--440. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C11. 2011. Information technology -- Programming languages -- C. In BS ISO/IEC 9899:2011.Google ScholarGoogle Scholar
  14. David Chase and Yossi Lev. 2005. Dynamic circular work-stealing deque. In Symposium on Parallelism in Algorithms and Architectures (SPAA’05). ACM, 21--28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. David Detlefs, Christine H. Flood, Alex Garthwaite, Paul A. Martin, Nir Shavit, and Guy L. Steele Jr. 2000. Even better DCAS-based concurrent deques. In Distributed Computing (DISC’00) (LNCS), Vol. 1914. Springer, 59--73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. David Dice. 2009. A race in LockSuport park() arising from weak memory models. Retrieved from https://blogs.oracle.com/dave/entry/a_race_in_locksupport_park.Google ScholarGoogle Scholar
  17. Edsger W. Dijkstra. 1965. Solution of a problem in concurrent programming control. Commun. ACM 8, 9 (1965), 569. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Xing Fang, Jaejin Lee, and Samuel P. Midkiff. 2003. Automatic fence insertion for shared memory multiprocessing. In International Conference on Supercomputing (ICS’03). ACM, 285--294. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Matteo Frigo, Charles E. Leiserson, and Keith H. Randall. 1998. The implementation of the Cilk-5 multithreaded language. In Programming Language Design and Implementation (PLDI’98). ACM, 212--223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Maurice Herlihy and Nir Shavit. 2008. The Art of Multiprocessor Programming. Morgan and Kaufmann, Burlington. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. IBM. 2009. Power ISA Version 2.06 Revision B.Google ScholarGoogle Scholar
  22. Saurabh Joshi and Daniel Kroening. 2015. Property-driven fence insertion using reorder bounded model checking. In International Symposium on Formal Methods (FM’15). Springer, 291--307.Google ScholarGoogle ScholarCross RefCross Ref
  23. Vineet Kahlon, Nishant Sinha, Erik Kruus, and Yun Zhang. 2009. Static data race detection for concurrent programs with asynchronous calls. In International Symposium on the Foundations of Software Engineering (FSE’09). ACM, 13--22. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Arvind Krishnamurthy and Katherine A. Yelick. 1996. Analyses and optimizations for shared address space programs. J. Par. Dist. Comp. 38, 2 (1996), 130--144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Daniel Kroening and Michael Tautschnig. 2014. Automating software analysis at large scale. In Doctoral Workshop on Mathematical and Engineering Methods in Computer Science (MEMICS’14). Springer, 30--39.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Michael Kuperstein, Martin T. Vechev, and Eran Yahav. 2010. Automatic inference of memory fences. In Formal Methods in Computer-Aided Design (FMCAD’10). IEEE, 111--119. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Michael Kuperstein, Martin T. Vechev, and Eran Yahav. 2011. Partial-coherence abstractions for relaxed memory models. In Programming Language Design and Implementation (PLDI’11). 187--198. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Leslie Lamport. 1979. How to make a correct multiprocess program execute correctly on a multiprocessor. IEEE Trans. Comput. 46, 7 (1979), 690--691. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Leslie Lamport. 1987. A fast mutual exclusion algorithm. ACM Trans. Comput. Syst. 5, 1 (1987), 1--11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Jaejin Lee and David A. Padua. 2001. Hiding relaxed memory consistency with a compiler. IEEE Trans. Comput. 50 (2001), 824--833. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Alexander Linden and Pierre Wolper. 2013. A verification-based approach to memory fence insertion in PSO memory systems. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS’13) (LNCS), Vol. 7795. Springer, 339--353. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Feng Liu, Nayden Nedev, Nedyalko Prisadnikov, Martin T. Vechev, and Eran Yahav. 2012. Dynamic synthesis for relaxed memory models. In Programming Language Design and Implementation (PLDI’12). ACM, 429--440. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Daniel Lustig, Caroline Trippel, Michael Pellauer, and Margaret Martonosi. 2015. ArMOR: Defending against memory consistency model mismatches in heterogeneous architectures. In International Symposium on Computer Architecture (ISCA’15). ACM, 388--400. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Daniel Marino, Abhayendra Singh, Todd D. Millstein, Madanlal Musuvathi, and Satish Narayanasamy. 2011. A case for an SC-preserving compiler. In Programming Language Design and Implementation (PLDI’11). ACM, 199--210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Yuri Meshman, Andrei Dan, Martin Vechev, and Eran Yahav. 2014. Synthesis of memory fences via refinement propagation. In Static Analysis Symposium (SAS’14). Springer, 237--252.Google ScholarGoogle ScholarCross RefCross Ref
  36. Maged M. Michael and Michael L. Scott. 1996. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In Symposium on Principles of Distributed Computing (PODC’96). ACM, 267--275. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Maged M. Michael, Martin T. Vechev, and Vijay A. Saraswat. 2009. Idempotent work stealing. In Principles and Practice of Parallel Programming (PPOPP’09). ACM, 45--54. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Vincent Nimal. 2015. Static Analyses over Weak Memory. Ph.D. Dissertation. University of Oxford.Google ScholarGoogle Scholar
  39. Brian Norris and Brian Demsky. 2013. CDSchecker: Checking concurrent data structures written with C/C++ atomics. In Object Oriented Programming Systems Languages & Applications (OOPSLA’13). 131--150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Scott Owens, Susmit Sarkar, and Peter Sewell. 2009. A better x86 memory model: x86-TSO. In Theorem Proving in Higher Order Logics (TPHOLs’09) (LNCS), Vol. 5674. Springer, 391--407. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Gary L. Peterson. 1981. Myths about the mutual exclusion problem. Inf. Process. Lett. 12, 3 (1981), 115--116.Google ScholarGoogle ScholarCross RefCross Ref
  42. Dennis Shasha and Marc Snir. 1988. Efficient and correct execution of parallel programs that share memory. TOPLAS 10, 2 (1988), 282--312. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. SPARC. 1994. SPARC Architecture Manual Version 9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Michael F. Spear, Maged M. Michael, Michael L. Scott, and Peng Wu. 2009. Reducing memory ordering overheads in software transactional memory. In International Symposium on Code Generation and Optimization (CGO’09). IEEE, 13--24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Zehra Sura, Xing Fang, Chi-Leung Wong, Samuel P. Midkiff, Jaejin Lee, and David A. Padua. 2005. Compiler techniques for high performance sequentially consistent Java programs. In Symposium on Principles and Practice of Parallel Programming (PPOPP’05). ACM, 2--13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Boleslaw K. Szymanski. 1988. A simple solution to Lamport’s concurrent programming problem with linear wait. In International Conference on Supercomputing (ICS’88). 621--626. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Robert Tarjan. 1973. Enumeration of the elementary circuits of a directed graph. SIAM J. Comput. 2, 3 (1973), 211--216.Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Viktor Vafeiadis and Francesco Zappa Nardelli. 2011. Verifying fence elimination optimisations. In Static Analysis (SAS’11) (LNCS), Vol. 6887. Springer, 146--162. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Glynn Winskel. 1986. Event structures. In Petri Nets: Central Models and Their Properties, Advances in Petri Nets 1986, Part II, Proceedings of an Advanced Course. 325--392. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Don’t Sit on the Fence: A Static Analysis Approach to Automatic Fence Insertion

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Programming Languages and Systems
        ACM Transactions on Programming Languages and Systems  Volume 39, Issue 2
        June 2017
        194 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/3062396
        Issue’s Table of Contents

        Copyright © 2017 Owner/Author

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 29 May 2017
        • Accepted: 1 September 2016
        • Revised: 1 August 2016
        • Received: 1 June 2015
        Published in toplas Volume 39, Issue 2

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!