Skip to main content

Local Nontermination Detection for Parallel C++ Programs

  • Conference paper
  • First Online:
Software Engineering and Formal Methods (SEFM 2019)

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

Included in the following conference series:

Abstract

One of the key problems with parallel programs is ensuring that they do not hang or wait indefinitely – i.e., there are no deadlocks, livelocks and the program proceeds towards its goals. In this work, we present a practical approach to detection of nonterminating sections of programs written in C or C++, and its implementation into the DIVINE model checker. This complements the existing techniques for finding safety violations such as assertion failures and memory errors. Our approach makes it possible to detect partial deadlocks and livelocks, i.e., those situations in which some of the threads are progressing normally while the others are waiting indefinitely. The approach is also applicable to programs that do not terminate (such as daemons with infinite control loops) as it can be configured to check only for termination of selected sections of the program. The termination criteria can be user-provided; however, DIVINE comes with the set of built-in termination criteria suited for the analysis of programs with mutexes and other common synchronisation primitives.

This work has been partially supported by the Czech Science Foundation grant No. 18-02177S.

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

Notes

  1. 1.

    https://divine.fi.muni.cz/2019/lnterm/.

  2. 2.

    This is not a problem in practice as any blocking synchronisation (such as waiting for a mutex) can be simulated by a busy waiting loop.

  3. 3.

    Also sometimes called bottom strongly connected components, or closed communicating classes, especially in the area of probabilistic system analysis [12].

  4. 4.

    For our purposes, a weakly-fair scheduler is a scheduler which ensures that on every accepting cycle in the state space all threads which existed during the execution of this cycle were also executed at least once on the cycle.

  5. 5.

    https://divine.fi.muni.cz/2019/lnterm.

  6. 6.

    https://www.boost.org/doc/libs/1_69_0/doc/html/thread.html.

References

  1. Agarwal, R., et al.: Detection of deadlock potentials in multithreaded programs. IBM J. Res. Dev. 54(5), 3:1–3:15 (2010)

    Article  Google Scholar 

  2. Baier, C., Katoen, J.-P.: Principles of Model Checking (Representation and Mind Series). The MIT Press, Cambridge (2008)

    MATH  Google Scholar 

  3. Baranová, Z., et al.: Model Checking of C and C++ with DIVINE 4. In: D’Souza, D., Narayan Kumar, K. (eds.) ATVA 2017. LNCS, vol. 10482, pp. 201–207. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-68167-2_14

    Chapter  Google Scholar 

  4. Barnat, J., Ročkai, P., Štill, V., Weiser, J.: Fast, dynamically-sized concurrent hash table. In: Fischer, B., Geldenhuys, J. (eds.) SPIN 2015. LNCS, vol. 9232, pp. 49–65. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-23404-5_5

    Chapter  Google Scholar 

  5. Bensalem, S., Havelund, K.: Scalable dynamic deadlock analysis of multi-threaded programs. In: 2005 Parallel and Distributed Systems: Testing and Debugging (2005)

    Google Scholar 

  6. Beyer, D.: Automatic verification of C and Java programs: SV-COMP 2019. In: Beyer, D., Huisman, M., Kordon, F., Steffen, B. (eds.) TACAS 2019. LNCS, vol. 11429, pp. 133–155. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-17502-3_9

    Chapter  Google Scholar 

  7. Cai, Y., Chan, W.K.: Magiclock: scalable detection of potential deadlocks in large-scale multithreaded programs. IEEE Trans. Softw. Eng. 40(3), 266–281 (2014)

    Article  Google Scholar 

  8. Chaki, S., Clarke, E., Ouaknine, J., Sharygina, N., Sinha, N.: Concurrent software verification with states, events, and deadlocks. Formal Aspects Comput. 17(4), 461–483 (2005)

    Article  Google Scholar 

  9. Demartini, C., Iosif, R., Sisto, R.: A deadlock detection tool for concurrent Java programs. Softw.: Pract. Exp. 29(7), 577–603 (1999)

    Google Scholar 

  10. Lauko, H., Ročkai, P., Barnat, J.: Symbolic computation via program transformation. In: Fischer, B., Uustalu, T. (eds.) ICTAC 2018. LNCS, vol. 11187, pp. 313–332. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-02508-3_17

    Chapter  Google Scholar 

  11. Ng, N., Yoshida, N.: Static deadlock detection for concurrent go by global session graph synthesis. In: Proceedings of the 25th International Conference on Compiler Construction, CC 2016, pp. 174–184. ACM, New York (2016)

    Google Scholar 

  12. Norris, J.R.: Markov Chains. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, Cambridge (1997)

    Book  Google Scholar 

  13. Ročkai, P., Štill, V., Černá, I., Barnat, J.: DiVM: model checking with LLVM and graph memory. J. Syst. Softw. 143, 1–13 (2018). https://divine.fi.muni.cz/2017/divm/

    Article  Google Scholar 

  14. Štill, V., Barnat, J.: Model checking of C++ programs under the x86-TSO memory model. In: Sun, J., Sun, M. (eds.) ICFEM 2018. LNCS, vol. 11232, pp. 124–140. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-02450-5_8

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vladimír Štill .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Štill, V., Barnat, J. (2019). Local Nontermination Detection for Parallel C++ Programs. In: Ölveczky, P., Salaün, G. (eds) Software Engineering and Formal Methods. SEFM 2019. Lecture Notes in Computer Science(), vol 11724. Springer, Cham. https://doi.org/10.1007/978-3-030-30446-1_20

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-30446-1_20

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-30445-4

  • Online ISBN: 978-3-030-30446-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics