Advertisement

Deadlock-Free Channels and Locks

  • K. Rustan M. Leino
  • Peter Müller
  • Jan Smans
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6012)

Abstract

The combination of message passing and locking to protect shared state is a useful concurrency pattern. However, programs that employ this pattern are susceptible to deadlock. That is, the execution may reach a state where each thread in a set waits for another thread in that set to release a lock or send a message.

This paper proposes a modular verification technique that prevents deadlocks in programs that use both message passing and locking. The approach prevents deadlocks by enforcing two rules: (0) a blocking receive is allowed only if another thread holds an obligation to send and (1) each thread must perform acquire and receive operations in accordance with a global order. The approach is proven sound and has been implemented in the Chalice program verifier.

Keywords

Object Reference Activation Record Proof Obligation Communicate Sequential Process Main Thread 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. 1.
    Albert, E., Arenas, P., Codish, M., Genaim, S., Puebla, G., Zanardini, D.: Termination analysis of Java bytecode. In: Barthe, G., de Boer, F.S. (eds.) FMOODS 2008. LNCS, vol. 5051, pp. 2–18. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  2. 2.
    Armstrong, J., Virding, R., Wikström, C., Williams, M.: Concurrent Programming in ERLANG, 2nd edn. Prentice Hall, Englewood Cliffs (1996)Google Scholar
  3. 3.
    Barnett, M., Chang, B.-Y.E., DeLine, R., Jacobs, B., Leino, K.R.M.: Boogie: A modular reusable verifier for object-oriented programs. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 364–387. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  4. 4.
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: Preventing data races and deadlocks. In: OOPSLA. ACM, New York (2002)Google Scholar
  5. 5.
    Boyland, J.: Checking interference with fractional permissions. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  6. 6.
    Cook, B., Podelski, A., Rybalchenko, A.: Termination proofs for systems code. In: PLDI. ACM, New York (2006)Google Scholar
  7. 7.
    Detlefs, D.L., Leino, K.R.M., Nelson, G., Saxe, J.B.: Extended static checking. Research Report 159, Compaq Systems Research Center (1998)Google Scholar
  8. 8.
    Fähndrich, M., Aiken, M., Hawblitzel, C., Hodson, O., Hunt, G., Larus, J.R., Levi, S.: Language support for fast and reliable message-based communication in Singularity OS. In: EuroSys (2006)Google Scholar
  9. 9.
    Feng, X.: Local rely-guarantee reasoning. In: POPL. ACM, New York (2009)Google Scholar
  10. 10.
    Flanagan, C., Leino, K.R.M., Lillibridge, M., Nelson, G., Saxe, J.B., Stata, R.: Extended static checking for Java. In: PLDI, ACM, New York (2002)Google Scholar
  11. 11.
    Gotsman, A., Berdine, J., Cook, B., Rinetzky, N., Sagiv, M.: Local reasoning for storable locks and threads. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 19–37. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Haack, C., Huisman, M., Hurlin, C.: Reasoning about Java’s reentrant locks. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 171–187. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Haack, C., Hurlin, C.: Separation logic contracts for a Java-like language with fork/join. In: Meseguer, J., Roşu, G. (eds.) AMAST 2008. LNCS, vol. 5140, pp. 199–215. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  14. 14.
    Hoare, C.A.R.: Communicating sequential processes. Commun. ACM 21(8) (1978)Google Scholar
  15. 15.
    Hoare, T., O’Hearn, P.: Separation logic semantics for communicating processes. Electronic Notes on Theoretical Comput. Sci. 212 (2008)Google Scholar
  16. 16.
    Hobor, A., Appel, A.W., Nardelli, F.Z.: Oracle semantics for concurrent separation logic. In: Drossopoulou, S. (ed.) ESOP 2008. LNCS, vol. 4960, pp. 353–367. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  17. 17.
    Jacobs, B.: A Statically Verifiable Programming Model for Concurrent Object-Oriented Programs. PhD thesis, Katholieke Universiteit Leuven (2007)Google Scholar
  18. 18.
    Jacobs, B., Piessens, F.: The VeriFast program verifier. Technical Report CW-520, Department of Computer Science, Katholieke Universiteit Leuven (2008)Google Scholar
  19. 19.
    Kobayashi, N.: Type systems for concurrent programs. In: UNU/IIST 10th Anniversary Colloquium (2002)Google Scholar
  20. 20.
    Kobayashi, N.: A new type system for deadlock-free processes. In: Baier, C., Hermanns, H. (eds.) CONCUR 2006. LNCS, vol. 4137, pp. 233–247. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  21. 21.
    Korty, J.A.: Sema: A Lint-like tool for analyzing semaphore usage in a multithreaded UNIX kernel. In: Proceedings of the Winter 1989 USENIX Conference. USENIX Association (1989)Google Scholar
  22. 22.
    Leino, K.R.M., Müller, P.: A basis for verifying multi-threaded programs. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 378–393. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  23. 23.
    Leino, K.R.M., Müller, P., Smans, J.: Verification of concurrent programs with Chalice. In: Foundations of Security Analysis and Design V: FOSAD 2007/2008/2009 Tutorial Lectures. LNCS, vol. 5705. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  24. 24.
    Leino, K.R.M., Müller, P., Smans, J.: Deadlock-free channels and locks (extended version). Technical Report CW573, Department of Computer Science, K.U.Leuven (2010)Google Scholar
  25. 25.
    Luecke, G.R., Zou, Y., Coyle, J., Hoekstra, J., Kraeva, M.: Deadlock detection in MPI programs. Concurrency and Computation: Practice and Experience 14(11) (2002)Google Scholar
  26. 26.
    O’Hearn, P.W.: Resources, concurrency, and local reasoning. Theoretical Comput. Sci. 375(1-3) (2007)Google Scholar
  27. 27.
    Pike, R.: Newsqueak: A language for communicating with mice. Computing Science Technical Report 143, AT&T Bell Laboratories (1989)Google Scholar
  28. 28.
    Pym, D.J., Tofts, C.M.N.: A calculus and logic of resources and processes. Formal Aspects of Computing 18(4) (2006)Google Scholar
  29. 29.
    Ritchie, D.M.: The Limbo programming language. In: Inferno Programmer’s Manual, vol. 2. Vita Nuova Holdings Ltd. (2000)Google Scholar
  30. 30.
    Smans, J., Jacobs, B., Piessens, F.: Implicit dynamic frames: Combining dynamic frames and separation logic. In: Drossopoulou, S. (ed.) ECOOP 2009 – Object-Oriented Programming. LNCS, vol. 5653, pp. 148–172. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  31. 31.
    Terauchi, T., Megacz, A.: Inferring channel buffer bounds via linear programming. In: Drossopoulou, S. (ed.) ESOP 2008. LNCS, vol. 4960. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  32. 32.
    Vafeiadis, V., Parkinson, M.: A marriage of rely/guarantee and separation logic. In: Caires, L., Vasconcelos, V.T. (eds.) CONCUR 2007. LNCS, vol. 4703, pp. 256–271. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  33. 33.
    Vasconcelos, V.T., Ravara, A., Gay, S.J.: Session types for functional multithreading. In: Gardner, P., Yoshida, N. (eds.) CONCUR 2004. LNCS, vol. 3170, pp. 497–511. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  34. 34.
    Vetter, J.S., de Supinski, B.R.: Dynamic software testing of MPI applications with umpire. In: Proceedings of the 2000 ACM/IEEE conference on Supercomputing. IEEE, Los Alamitos (2000)Google Scholar
  35. 35.
    Villard, J., Lozes, É., Calcagno, C.: Proving copyless message passing. In: Hu, Z. (ed.) APLAS 2009. LNCS, vol. 5904, pp. 194–209. Springer, Heidelberg (2009)Google Scholar
  36. 36.
    Winterbottom, P.: Alef language reference manual. In: Plan 9 Programmer’s Manual: Volume Two. AT&T Bell Laboratories (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • K. Rustan M. Leino
    • 1
  • Peter Müller
    • 2
  • Jan Smans
    • 3
  1. 1.Microsoft ResearchRedmondUSA
  2. 2.ETH ZurichSwitzerland
  3. 3.KU LeuvenBelgium

Personalised recommendations