Abstract
Writing low-level concurrent software has traditionally required intimate knowledge of the entire toolchain and often has involved coding in assembly. New language standards have extended C and C++ with support for low-level atomic operations and a weak memory model, enabling developers to write portable and efficient multithreaded code.
Developing correct low-level concurrent code is well-known to be especially difficult under a weak memory model, where code behavior can be surprising. Building reliable concurrent software using C/C++ low-level atomic operations will likely require tools that help developers discover unexpected program behaviors.
In this paper we present CDSChecker, a tool for exhaustively exploring the behaviors of concurrent code under the C/C++ memory model. We develop several novel techniques for modeling the relaxed behaviors allowed by the memory model and for minimizing the number of execution behaviors that CDSChecker must explore. We have used CDSChecker to exhaustively unit test several concurrent data structure implementations on specific inputs and have discovered errors in both a recently published C11 implementation of a work-stealing queue and a single producer, single consumer queue implementation.
- http://stackoverflow.com/questions/8115267/writing-a-spinning-thread-barrier-using-c11-atomics. Oct. 2012.Google Scholar
- ISO/IEC 9899:2011, Information technology - programming languages - C.Google Scholar
- ISO/IEC 14882:2011, Information technology - programming languages - C++.Google Scholar
- http://www.justsoftwaresolutions.co.uk/threading/. Dec. 2012.Google Scholar
- http://cbloomrants.blogspot.com/2011/07/07-18-11-mcs-list-based-lock_18.html. Oct. 2012.Google Scholar
- http://cbloomrants.blogspot.com/2011/07/07-30-11-look-at-some-bounded-queues.html. Oct. 2012.Google Scholar
- https://groups.google.com/forum/#!msg/comp.programming.threads/nSSFT9vKEe0/7eD3ioDg6nEJ. Oct. 2012.Google Scholar
- M. Batty, S. Owens, S. Sarkar, P. Sewell, and T. Weber. Mathematizing C++ concurrency. In Proceedings of the Symposium on Principles of Programming Languages, 2011. Google Scholar
Digital Library
- M. Batty, M. Dodds, and A. Gotsman. Library abstraction for C/C++ concurrency. In Proceedings of the Symposium on Principles of Programming Languages, 2013. Google Scholar
Digital Library
- J. C. Blanchette, T.Weber, M. Batty, S. Owens, and S. Sarkar. Nitpicking C++ concurrency. In Proceedings of the 13th International ACM SIGPLAN Symposium on Principles and Practices of Declarative Programming, 2011. Google Scholar
Digital Library
- H. Boehm. Can seqlocks get along with programming language memory models? In Proceedings of the 2012 ACM SIGPLAN Workshop on Memory Systems Performance and Correctness, 2012. Google Scholar
Digital Library
- H. J. Boehm and S. V. Adve. Foundations of the C++ concurrency memory model. In Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2008. Google Scholar
Digital Library
- S. Burckhardt, C. Dern, M. Musuvathi, and R. Tan. Line-up: A complete and automatic linearizability checker. In Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2010. Google Scholar
Digital Library
- C. Click. A lock-free hash table. http://www.azulsystems.com/events/javaone_2007/2007_LockFreeHash.pdf, May 2007.Google Scholar
- A. De, A. Roychoudhury, and D. D'Souza. Java memory model aware software validation. In Proceedings of the 8th ACM SIGPLAN-SIGSOFTWorkshop on Program Analysis for Software Tools and Engineering, 2008. Google Scholar
Digital Library
- T. Elmas, S. Qadeer, and S. Tasiran. Goldilocks: A race and transaction-aware Java runtime. In Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2007. Google Scholar
Digital Library
- D. Engler and K. Ashcraft. RacerX: Effective, static detection of race conditions and deadlocks. In Proceedings of the Nineteenth ACM Symposium on Operating Systems Principles, 2003. Google Scholar
Digital Library
- C. Flanagan and S. N. Freund. FastTrack: Efficient and precise dynamic race detection. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2009. Google Scholar
Digital Library
- C. Flanagan and S. N. Freund. Adversarial memory for detecting destructive races. In Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2010. Google Scholar
Digital Library
- C. Flanagan and P. Godefroid. Dynamic partial-order reduction for model checking software. In Proceedings of the Symposium on Principles of Programming Languages, Jan. 2005. Google Scholar
Digital Library
- P. Godefroid. Partial-order methods for the verification of concurrent systems: An approach to the state-explosion problem. Lecture Notes in Computer Science, 1996. Google Scholar
Digital Library
- P. Godefroid. Model checking for programming languages using VeriSoft. In Proceedings of the Symposium on Principles of Programming Languages, 1997. Google Scholar
Digital Library
- G. J. Holzmann. The SPIN Model Checker: Primer and Reference Manual. Addison-Wesley Professional, 1st edition, 2003. Google Scholar
Digital Library
- T. Q. Huynh and A. Roychoudhury. A memory model sensitive checker for C#. In Proceedings of the 14th International Conference on Formal Methods, 2006. Google Scholar
Digital Library
- B. Jonsson. State-space exploration for concurrent algorithms under weak memory orderings. SIGARCH Computer Architecture News, 36(5):65--71, June 2009. Google Scholar
Digital Library
- M. Kuperstein, M. Vechev, and E. Yahav. Automatic inference of memory fences. In Proceedings of the Conference on Formal Methods in Computer-Aided Design, 2010. Google Scholar
Digital Library
- M. Kuperstein, M. Vechev, and E. Yahav. Partial-coherence abstractions for relaxed memory models. In Proceedings of the 2011 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2011. Google Scholar
Digital Library
- L. Lamport. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, 21(7):558--565, July 1978. Google Scholar
Digital Library
- N. M. Lê, A. Pop, A. Cohen, and F. Zappa Nardelli. Correct and efficient work-stealing for weak memory models. In Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 2013. Google Scholar
Digital Library
- B. Lucia, L. Ceze, K. Strauss, S. Qadeer, and H. Boehm. Conflict exceptions: Simplifying concurrent language semantics with precise hardware exceptions for data-races. In Proceedings of the 37th Annual International Symposium on Computer Architecture, 2010. Google Scholar
Digital Library
- D. Marino, A. Singh, T. Millstein, M. Musuvathi, and S. Narayanasamy. A case for an sc-preserving compiler. In Proceedings of the 2011 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2011. Google Scholar
Digital Library
- J. M. Mellor-Crummey and M. L. Scott. Synchronization without contention. In Proceedings of the Fourth International Conference on Architectural Support for Programming Languages and Operating Systems, pages 269--278, 1991. Google Scholar
Digital Library
- M. M. Michael and M. L. Scott. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In Proceedings of the Fifteenth Annual ACM Symposium on Principles of Distributed Computing, 1996. Google Scholar
Digital Library
- M. Musuvathi, S. Qadeer, P. A. Nainar, T. Ball, G. Basler, and I. Neamtiu. Finding and reproducing Heisenbugs in concurrent programs. In Proceedings of the 8th Symposium on Operating Systems Design and Implementation, 2008. Google Scholar
Digital Library
- S. Park and D. L. Dill. An executable specification and verifier for relaxed memory order. IEEE Transactions on Computers, 48, 1999. Google Scholar
Digital Library
- S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. Eraser: A dynamic data race detector for multithreaded programs. ACM Transactions on Computing Systems, 15:391--411, Nov. 1997. Google Scholar
Digital Library
- D. Vyukov. Relacy race detector. http://relacy.sourceforge.net/, 2011 Oct.Google Scholar
- C. Wang, Y. Yang, A. Gupta, and G. Gopalakrishnan. Dynamic model checking with property driven pruning to detect race conditions. ATVA LNCS, (126--140), 2008. Google Scholar
Digital Library
- Y. Yang, X. Chen, G. Gopalakrishnan, and R. M. Kirby. Efficient stateful dynamic partial order reduction. In Proceedings of the 15th International SPIN Workshop on Model Checking Software, 2008. Google Scholar
Digital Library
- Y. Yang, X. Chen, G. Gopalakrishnan, and C. Wang. Automatic discovery of transition symmetry in multithreaded programs using dynamic analysis. In Proceedings of the 16th International SPIN Workshop on Model Checking Software, pages 279--295, 2009. Google Scholar
Digital Library
Index Terms
CDSchecker: checking concurrent data structures written with C/C++ atomics
Recommendations
CDSchecker: checking concurrent data structures written with C/C++ atomics
OOPSLA '13: Proceedings of the 2013 ACM SIGPLAN international conference on Object oriented programming systems languages & applicationsWriting low-level concurrent software has traditionally required intimate knowledge of the entire toolchain and often has involved coding in assembly. New language standards have extended C and C++ with support for low-level atomic operations and a weak ...
A Practical Approach for Model Checking C/C++11 Code
Writing low-level concurrent software has traditionally required intimate knowledge of the entire toolchain and often has involved coding in assembly. New language standards have extended C and C++ with support for low-level atomic operations and a weak ...
SATCheck: SAT-directed stateless model checking for SC and TSO
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsWriting low-level concurrent code is well known to be challenging and error prone. The widespread deployment of multi-core hardware and the shift towards using low-level concurrent data structures has moved the problem into the mainstream. Finding bugs ...







Comments