Skip to main content

Checking Concurrency Coding Rules

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2025)

Abstract

We present an approach for checking that Java programs correctly use libraries such as java.util.concurrent.locks for synchronizing concurrent tasks. Concretely, the article develops methods to check that the behaviour of a program is in accordance with a set of coding rules that govern the correct usage of the library. Here such coding rules are formalized as Prolog predicates that judge whether the history of interactions between program and library represents correct usage or not. The history of interactions is obtained by tracing the interactions between the program and the library when executing a representative test suite. The approach is evaluated in a case study in which around 200 independent monitor-based Java implementations of a common specification are analysed to check adherence to the concurrency coding rules.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Input parameters are specified using the [i] qualifier; output parameters use the [o] qualifier.

  2. 2.

    Note that the code sketch assumes that every account has a transfer queue.

  3. 3.

    Byteman permits tracing invocation (entry) and exit (return or throw) of a method call.

  4. 4.

    The number of rules vary as the implementations are free to organise the shared state in different ways, and Byteman rules must trace all such accesses.

References

  1. Agarwal, R., Stoller, S.D.: Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables. In: Proceedings of the 2006 Workshop on Parallel and Distributed Systems: Testing and Debugging, PADTAD 2006, pp. 51–60. ACM, New York (2006)

    Google Scholar 

  2. Chen, W., Warren, D.S.: Tabled evaluation with delaying for general logic programs. J. ACM 43(1), 20–74 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  3. Claessen, K., Hughes, J.: Quickcheck: a lightweight tool for random testing of haskell programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 268–279. ACM, New York (2000)

    Google Scholar 

  4. Dinn, A.E.: Flexible, dynamic injection of structured advice using byteman. In: Borba, P., Chiba, S. (eds.) Companion Volume of the 10th International Conference on Aspect-Oriented Software Development, AOSD 2011, pp. 41–50. ACM (2011)

    Google Scholar 

  5. Falcone, Y., Krstic, S., Reger, G., Traytel, D.: A taxonomy for classifying runtime verification tools. Int. J. Softw. Tools Technol. Transf. 23(2), 255–284 (2021). https://doi.org/10.1007/S10009-021-00609-Z

    Article  MATH  Google Scholar 

  6. Fredlund, L., Mariño, J., Alborodo, R.N.N., Herranz, A.: A testing-based approach to ensure the safety of shared resource concurrent systems. Proc. Inst. Mech. Eng. Part O: J. Risk Reliab. (2015)

    Google Scholar 

  7. Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990)

    Article  MATH  Google Scholar 

  8. Herranz, A., Mariño, J.: A verified implementation of priority monitors in Java. In: Proceedings of the 2011 International Conference on Formal Verification of Object-Oriented Software, FoVeOOS 2011, pp. 160–177. Springer, Heidelberg (2012)

    Google Scholar 

  9. Herranz, A., Mariño, J., Carro, M., Moreno Navarro, J.J.: Modeling concurrent systems with shared resources. In: Alpuente, M., Cook, B., Joubert, C. (eds.) Formal Methods for Industrial Critical Systems. LNCS, vol. 5825, pp. 102–116. Springer, Cham (2009)

    Google Scholar 

  10. Hsiao, C.H., et al.: Race detection for event-driven mobile applications. SIGPLAN Not. 49(6), 326–336 (2014). https://doi.org/10.1145/2666356.2594330

    Article  MATH  Google Scholar 

  11. Lochmann, A., Schirmeier, H., Borghorst, H., Spinczyk, O.: Lockdoc: trace-based analysis of locking in the linux kernel. In: Candea, G., van Renesse, R., Fetzer, C. (eds.) Proceedings of the 14th EuroSys Conference 2019, Dresden, Germany, pp. 11:1–11:15. ACM (2019)

    Google Scholar 

  12. Mariño, J., Alborodo, R.N.N., Fredlund, L., Herranz, Á.: Synthesis of verified concurrent Java components from formal models. Softw. Syst. Model. (2016)

    Google Scholar 

  13. Marpons-Ucero, G., Mariño-Carballo, J., Carro, M., Herranz-Nieva, Á., Moreno-Navarro, J.J., Fredlund, L.: Automatic coding rule conformance checking using logic programming. In: PADL 2008. LNCS, vol. 4902, pp. 18–34. Springer, Cham (2008)

    Google Scholar 

  14. Mutlu, E., Tasiran, S., Livshits, B.: Detecting Javascript races that matter. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015, pp. 381–392. Association for Computing Machinery, New York (2015). https://doi.org/10.1145/2786805.2786820

  15. Song, F., Touili, T.: Model-checking software library API usage rules. In: Johnsen, E.B., Petre, L. (eds.) Integrated Formal Methods, 10th International Conference, IFM 2013, Turku, Finland, 10–14 June 2013. LNCS, vol. 7940, pp. 192–207. Springer, Cham (2013)

    Google Scholar 

  16. Welch, P.H., Brown, N., Moores, J., Chalmers, K., Sputh, B.H.C.: Integrating and extending JCSP. In: McEwan, A.A., Schneider, S.A., Ifill, W., Welch, P.H. (eds.) The 30th Communicating Process Architectures Conference, CPA 2007. Concurrent Systems Engineering Series, vol. 65, pp. 349–370. IOS Press (2007)

    Google Scholar 

  17. Yu, T., Srisa-an, W., Rothermel, G.: Simracer: an automated framework to support testing for process-level races. In: Proceedings of the 2013 International Symposium on Software Testing and Analysis, ISSTA 2013, p. 167–177. Association for Computing Machinery, New York (2013). https://doi.org/10.1145/2483760.2483771

Download references

Acknowledgements

This work has been partly funded by the Ministerio de Ciencia e Innovación of Spain (SAFER project, ref. PID2019-104735RB-C44).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lars-Åke Fredlund .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Fredlund, LÅ., Herranz, Á., Mariño, J. (2025). Checking Concurrency Coding Rules. In: Erdem, E., Vidal, G. (eds) Practical Aspects of Declarative Languages. PADL 2025. Lecture Notes in Computer Science, vol 15537. Springer, Cham. https://doi.org/10.1007/978-3-031-84924-4_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-84924-4_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-84923-7

  • Online ISBN: 978-3-031-84924-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics