Abstract
Event-driven multi-threaded programming is an important idiom for structuring concurrent computations. Stateless Model Checking (SMC) is an effective verification technique for multi-threaded programs, especially when coupled with Dynamic Partial Order Reduction (DPOR). Existing SMC techniques are often ineffective in handling event-driven programs, since they will typically explore all possible orderings of event processing, even when events do not conflict. We present Event-DPOR, a DPOR algorithm tailored to event-driven multi-threaded programs. It is based on Optimal-DPOR, an optimal DPOR algorithm for multi-threaded programs; we show how it can be extended for event-driven programs. We prove correctness of Event-DPOR for all programs, and optimality for a large subclass. One complication is that an operation in Event-DPOR, which checks for redundancy of new executions, is NP-hard, as we show in this paper; we address this by a sequence of inexpensive (but incomplete) tests which check for redundancy efficiently. Our implementation and experimental evaluation show that, in comparison with other tools in which handler threads are simulated using locks, Event-DPOR can be exponentially faster than other state-of-the-art DPOR algorithms on a variety of programs and manages to completely avoid unnecessary exploration of executions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
Throughout this paper, we assume that threads are spawned by a main thread, and that all shared variables get initialized to 0, also by the main thread.
- 3.
The relation \(w' \sqsubseteq _{[E]} w\) is also introduced in [28], as “w is a dependence-covering sequence of \(w'\).”.
- 4.
All our attempts to use R4 failed miserably; the tool has not been updated since 2016.
- 5.
GenMC v0.6.1 (released July 2021) warns that LAPOR usage with –mo is experimental; in fact, LAPOR support has been dropped in more recent GenMC versions.
References
Abdulla, P., Aronis, S., Jonsson, B., Sagonas, K.: Optimal dynamic partial order reduction. In: Symposium on Principles of Programming Languages, POPL 2014, pp. 373–384. ACM, New York (2014). https://doi.org/10.1145/2535838.2535845. http://doi.acm.org/10.1145/2535838.2535845
Abdulla, P.A., Aronis, S., Atig, M.F., Jonsson, B., Leonardsson, C., Sagonas, K.: Stateless model checking for TSO and PSO. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 353–367. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_28
Abdulla, P.A., Aronis, S., Jonsson, B., Sagonas, K.: Source sets: a foundation for optimal dynamic partial order reduction. J. ACM 64(4), 25:1–25:49 (2017). https://doi.org/10.1145/3073408. http://doi.acm.org/10.1145/3073408
Abdulla, P.A., et al.: Tailoring stateless model checking for event-driven multi-threaded programs. arXiv CoRR (2023). https://doi.org/10.48550/arXiv.2307.15930. Extended Version with Proofs
Abdulla, P.A., Atig, M.F., Jonsson, B., Lång, M., Ngo, T.P., Sagonas, K.: Optimal stateless model checking for reads-from equivalence under sequential consistency. Proc. ACM Program. Lang. 3(OOPSLA), 150:1–150:29 (2019). https://doi.org/10.1145/3360576
Albert, E., Arenas, P., de la Banda, M.G., Gómez-Zamalloa, M., Stuckey, P.J.: Context-sensitive dynamic partial order reduction. In: Majumdar, R., Kunčak, V. (eds.) CAV 2017. LNCS, vol. 10426, pp. 526–543. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63387-9_26
Aronis, S., Jonsson, B., Lång, M., Sagonas, K.: Optimal dynamic partial order reduction with observers. In: Beyer, D., Huisman, M. (eds.) TACAS 2018. LNCS, vol. 10806, pp. 229–248. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-89963-3_14
Bielik, P., Raychev, V., Vechev, M.T.: Scalable race detection for android applications. In: Aldrich, J., Eugster, P. (eds.) Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2015, pp. 332–348. ACM (2015). https://doi.org/10.1145/2814270.2814303
Chalupa, M., Chatterjee, K., Pavlogiannis, A., Sinha, N., Vaidya, K.: Data-centric dynamic partial order reduction. Proc. ACM Program. Lang. 2(POPL), 31:1–31:30 (2018). https://doi.org/10.1145/3158119. http://doi.acm.org/10.1145/3158119
Christakis, M., Gotovos, A., Sagonas, K.: Systematic testing for detecting concurrency errors in Erlang programs. In: Sixth IEEE International Conference on Software Testing, Verification and Validation, ICST 2013, Los Alamitos, CA, USA, pp. 154–163. IEEE (2013). https://doi.org/10.1109/ICST.2013.50
Dabek, F., Zeldovich, N., Kaashoek, M.F., Mazières, D., Morris, R.T.: Event-driven programming for robust software. In: Muller, G., Jul, E. (eds.) Proceedings of the 10th ACM SIGOPS European Workshop, pp. 186–189. ACM (2002). https://doi.org/10.1145/1133373.1133410
Desai, A., Gupta, V., Jackson, E.K., Qadeer, S., Rajamani, S.K., Zufferey, D.: P: safe asynchronous event-driven programming. In: Boehm, H., Flanagan, C. (eds.) ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2013, pp. 321–332. ACM (2013). https://doi.org/10.1145/2491956.2462184
Flanagan, C., Godefroid, P.: Dynamic partial-order reduction for model checking software. In: Principles of Programming Languages, (POPL), pp. 110–121. ACM, New York (2005). https://doi.org/10.1145/1040305.1040315. http://doi.acm.org/10.1145/1040305.1040315
Godefroid, P.: Partial-order methods for the verification of concurrent systems: an approach to the state-explosion problem. Ph.D. thesis, University of Liège (1996). https://doi.org/10.1007/3-540-60761-7. http://www.springer.com/gp/book/9783540607618, also, volume 1032 of LNCS, Springer
Godefroid, P.: Model checking for programming languages using VeriSoft. In: Principles of Programming Languages, (POPL), New York, NY, USA, pp. 174–186. ACM Press (1997). https://doi.org/10.1145/263699.263717. http://doi.acm.org/10.1145/263699.263717
Godefroid, P.: Software model checking: the VeriSoft approach. Form. Methods Syst. Des. 26(2), 77–101 (2005). https://doi.org/10.1007/s10703-005-1489-x
Godefroid, P., Hanmer, R.S., Jagadeesan, L.: Model checking without a model: an analysis of the heart-beat monitor of a telephone switch using VeriSoft. In: Proceedings of the ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA, pp. 124–133. ACM, New York (1998). https://doi.org/10.1145/271771.271800
Hsiao, C., et al.: Race detection for event-driven mobile applications. In: O’Boyle, M.F.P., Pingali, K. (eds.) ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2014, pp. 326–336. ACM (2014). https://doi.org/10.1145/2594291.2594330
Hu, Y., Neamtiu, I., Alavi, A.: Automatically verifying and reproducing event-based races in android apps. In: Zeller, A., Roychoudhury, A. (eds.) Proceedings of the 25th International Symposium on Software Testing and Analysis, ISSTA 2016, pp. 377–388. ACM (2016). https://doi.org/10.1145/2931037.2931069
Jensen, C.S., Møller, A., Raychev, V., Dimitrov, D., Vechev, M.T.: Stateless model checking of event-driven applications. In: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2015, pp. 57–73. ACM, New York (2015). https://doi.org/10.1145/2814270.2814282
Jhala, R., Majumdar, R.: Interprocedural analysis of asynchronous programs. In: Hofmann, M., Felleisen, M. (eds.) Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2007, Nice, France, 17–19 January 2007, pp. 339–350. ACM (2007). https://doi.org/10.1145/1190216.1190266
Kokologiannakis, M., Lahav, O., Sagonas, K., Vafeiadis, V.: Effective stateless model checking for C/C++ concurrency. Proc. ACM Program. Lang. 2(POPL), 17:1–17:32 (2018). https://doi.org/10.1145/3158105
Kokologiannakis, M., Marmanis, I., Gladstein, V., Vafeiadis, V.: Truly stateless, optimal dynamic partial order reduction. Proc. ACM Program. Lang. 6(POPL), 1–28 (2022). https://doi.org/10.1145/3498711
Kokologiannakis, M., Raad, A., Vafeiadis, V.: Effective lock handling in stateless model checking. Proc. ACM Program. Lang. 3(OOPSLA), 173:1–173:26 (2019). https://doi.org/10.1145/3360599
Kokologiannakis, M., Sagonas, K.: Stateless model checking of the Linux kernel’s hierarchical read-copy-update (tree RCU). In: Proceedings of International SPIN Symposium on Model Checking of Software, SPIN 2017, pp. 172–181. ACM, New York (2017). https://doi.org/10.1145/3092282.3092287
Kokologiannakis, M., Vafeiadis, V.: GenMC: a model checker for weak memory models. In: Silva, A., Leino, K.R.M. (eds.) CAV 2021. LNCS, vol. 12759, pp. 427–440. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-81685-8_20
Kragl, B., Enea, C., Henzinger, T.A., Mutluergil, S.O., Qadeer, S.: Inductive sequentialization of asynchronous programs. In: Donaldson, A.F., Torlak, E. (eds.) Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, pp. 227–242. ACM (2020). https://doi.org/10.1145/3385412.3385980
Maiya, P., Gupta, R., Kanade, A., Majumdar, R.: Partial order reduction for event-driven multi-threaded programs. In: Chechik, M., Raskin, J.-F. (eds.) TACAS 2016. LNCS, vol. 9636, pp. 680–697. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49674-9_44
Maiya, P., Kanade, A.: Efficient computation of happens-before relation for event-driven programs. In: Bultan, T., Sen, K. (eds.) Proceedings of the 26th International Symposium on Software Testing and Analysis, ISSTA 2017, pp. 102–112. ACM, New York (2017). https://doi.org/10.1145/3092703.3092733
Maiya, P., Kanade, A., Majumdar, R.: Race detection for android applications. In: O’Boyle, M.F.P., Pingali, K. (eds.) ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2014, Edinburgh, United Kingdom, 09–11 June 2014, pp. 316–325. ACM (2014). https://doi.org/10.1145/2594291.2594311
Mazières, D.: A toolkit for user-level file systems. In: Park, Y. (ed.) Proceedings of the General Track: 2001 USENIX Annual Technical Conference, pp. 261–274. USENIX (2001). http://www.usenix.org/publications/library/proceedings/usenix01/mazieres.html
Mazurkiewicz, A.: Trace theory. In: Brauer, W., Reisig, W., Rozenberg, G. (eds.) ACPN 1986. LNCS, vol. 255, pp. 278–324. Springer, Heidelberg (1987). https://doi.org/10.1007/3-540-17906-2_30
Mednieks, Z., Dornin, L., Meike, G.B., Nakamura, M.: Programming Android. O’Reilly Media, Inc. (2012)
Musuvathi, M., Qadeer, S., Ball, T., Basler, G., Nainar, P.A., Neamtiu, I.: Finding and reproducing heisenbugs in concurrent programs. In: Proceedings of the 8th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2008, pp. 267–280. USENIX Association, Berkeley (2008). https://dl.acm.org/citation.cfm?id=1855741.1855760
Norris, B., Demsky, B.: A practical approach for model checking C/C++11 code. ACM Trans. Program. Lang. Syst. 38(3), 10:1–10:51 (2016). https://doi.org/10.1145/2806886. http://doi.acm.org/10.1145/2806886
Petrov, B., Vechev, M.T., Sridharan, M., Dolby, J.: Race detection for web applications. In: Vitek, J., Lin, H., Tip, F. (eds.) ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2012, Beijing, China, 11–16 June 2012, pp. 251–262. ACM (2012). https://doi.org/10.1145/2254064.2254095
Raychev, V., Vechev, M.T., Sridharan, M.: Effective race detection for event-driven programs. In: Hosking, A.L., Eugster, P.T., Lopes, C.V. (eds.) Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, part of SPLASH 2013, Indianapolis, IN, USA, 26–31 October 2013, pp. 151–166. ACM (2013). https://doi.org/10.1145/2509136.2509538
Santhiar, A., Kaleeswaran, S., Kanade, A.: Efficient race detection in the presence of programmatic event loops. In: Zeller, A., Roychoudhury, A. (eds.) Proceedings of the 25th International Symposium on Software Testing and Analysis, ISSTA 2016, Saarbrücken, Germany, 18–20 July 2016, pp. 366–376. ACM (2016). https://doi.org/10.1145/2931037.2931068
Trimananda, R., Luo, W., Demsky, B., Xu, G.H.: Stateful dynamic partial order reduction for model checking event-driven applications that do not terminate. In: Finkbeiner, B., Wies, T. (eds.) VMCAI 2022. LNCS, vol. 13182, pp. 400–424. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-94583-1_20
Yang, Yu., Chen, X., Gopalakrishnan, G., Kirby, R.M.: Efficient stateful dynamic partial order reduction. In: Havelund, K., Majumdar, R., Palsberg, J. (eds.) SPIN 2008. LNCS, vol. 5156, pp. 288–305. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-85114-1_20
Yi, X., Wang, J., Yang, X.: Stateful dynamic partial-order reduction. In: Liu, Z., He, J. (eds.) ICFEM 2006. LNCS, vol. 4260, pp. 149–167. Springer, Heidelberg (2006). https://doi.org/10.1007/11901433_9
Zhang, N., Kusano, M., Wang, C.: Dynamic partial order reduction for relaxed memory models. In: Programming Language Design and Implementation (PLDI), pp. 250–259. ACM, New York (2015). https://doi.org/10.1145/2737924.2737956. http://doi.acm.org/10.1145/2737924.2737956
Acknowledgements
This work was partially supported by the Swedish Research Council through grants #621-2017-04812 and 2019-05466, and by the Swedish Foundation for Strategic Research through project aSSIsT. We thank the anonymous reviewers for comments and suggestions which have improved the presentation.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Abdulla, P.A. et al. (2023). Tailoring Stateless Model Checking for Event-Driven Multi-threaded Programs. In: André, É., Sun, J. (eds) Automated Technology for Verification and Analysis. ATVA 2023. Lecture Notes in Computer Science, vol 14216. Springer, Cham. https://doi.org/10.1007/978-3-031-45332-8_9
Download citation
DOI: https://doi.org/10.1007/978-3-031-45332-8_9
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-45331-1
Online ISBN: 978-3-031-45332-8
eBook Packages: Computer ScienceComputer Science (R0)