Detecting semantic violations of lock-free data structures through C++ contracts Articles uri icon

publication date

  • March 2019

start page

  • 1

end page

  • 22

International Standard Serial Number (ISSN)

  • 0920-8542

Electronic International Standard Serial Number (EISSN)

  • 1573-0484


  • The use of synchronization mechanisms in multithreaded applications is essential on shared-memory multi-core architectures. However, debugging parallel applications to avoid potential failures, such as data races or deadlocks, can be challenging. Race detectors are key to spot such concurrency bugs; nevertheless, if lock-free data structures are used, these may emit a significant number of false positives. In this paper, we present a framework for semantic violation detection of lock-free data structures which makes use of contracts, a novel feature of the upcoming C++20, and a customized version of the ThreadSanitizer race detector. We evaluate the detection accuracy of the framework in terms of false positives and false negatives leveraging some synthetic benchmarks which make use of the SPSC and MPMC lock-free queue structures from the Boost C++ library. Thanks to this framework, we are able to check the correct use of lock-free data structures, thus reducing the number of false positives.


  • Computer Science


  • parallel programming; semantic violation detection; c++ contracts; lock-free data structures