A Type and Effect System for Determinism in Multithreaded Programs

  • Yi Lu
  • John Potter
  • Chenyi Zhang
  • Jingling Xue
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7211)

Abstract

There has been much recent interest in supporting deterministic parallelism in imperative programs. Structured parallel programming models have used type systems or static analysis to enforce determinism by constraining potential interference of lexically scoped tasks. But similar support for multithreaded programming, where threads may be ubiquitously spawned with arbitrary lifetimes, especially to achieve a modular and manageable combination of determinism and nondeterminism in multithreaded programs, remains an open problem.

This paper proposes a simple and intuitive approach for tracking thread interference and capturing both determinism and nondeterminism as computational effects. This allows us to present a type and effect system for statically reasoning about determinism in multithreaded programs. Our general framework may be used in multithreaded languages for supporting determinism, or in structured parallel models for supporting threads. Even more sophisticated concurrency models, such as actors, are often implemented on top of an underlying threading model, thus the underlying ideas presented here should be of value in reasoning about the correctness of such implementations.

Keywords

Type System Operational Semantic Reference Type Program Point Data Race 
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.
    Bocchino Jr., R.L., Adve, V.S., Dig, D., Adve, S.V., Heumann, S., Komuravelli, R., Overbey, J., Simmons, P., Sung, H., Vakilian, M.: A type and effect system for Deterministic Parallel Java. In: OOPSLA (2009)Google Scholar
  2. 2.
    Bocchino Jr., R.L., Heumann, S., Honarmand, N., Adve, S.V., Adve, V.S., Welc, A., Shpeisman, T.: Safe nondeterminism in a deterministic-by-default parallel language. In: POPL (2011)Google Scholar
  3. 3.
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: Preventing data races and deadlocks. In: OOPSLA (2002)Google Scholar
  4. 4.
    Boyland, J.: Checking Interference with Fractional Permissions. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 55–72. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  5. 5.
    Burnim, J., Sen, K.: Asserting and checking determinism for multithreaded programs. In: FSE (2009)Google Scholar
  6. 6.
    Clarke, D., Drossopoulou, S.: Ownership, encapsulation and disjointness of type and effect. In: OOPSLA (2002)Google Scholar
  7. 7.
    Clarke, D., Wrigstad, T.: External Uniqueness is Unique Enough. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 176–201. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  8. 8.
    Dodds, M., Jagannathan, S., Parkinson, M.J.: Modular reasoning for deterministic parallelism. In: POPL (2011)Google Scholar
  9. 9.
    Flanagan, C., Abadi, M.: Types for Safe Locking. In: Swierstra, S.D. (ed.) ESOP 1999. LNCS, vol. 1576, pp. 91–108. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  10. 10.
    Hogg, J.: Islands: aliasing protection in object-oriented languages. In: OOPSLA (1991)Google Scholar
  11. 11.
    Kobayashi, N.: Type Systems for Concurrent Programs. In: Aichernig, B.K. (ed.) Formal Methods at the Crossroads. From Panacea to Foundational Support. LNCS, vol. 2757, pp. 439–453. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  12. 12.
    Lea, D.: A Java fork/join framework. In: Java Grande (2000)Google Scholar
  13. 13.
    Lee, E.A.: The problem with threads. IEEE Computer 39(5) (2006)Google Scholar
  14. 14.
    Lu, Y., Potter, J.: On Ownership and Accessibility. In: Hu, Q. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 99–123. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  15. 15.
    Lu, Y., Potter, J.: Protecting representation with effect encapsulation. In: POPL (2006)Google Scholar
  16. 16.
    Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: POPL (1988)Google Scholar
  17. 17.
    Neamtiu, I., Hicks, M., Foster, J.S., Pratikakis, P.: Contextual effects for version-consistent dynamic software updating and safe concurrent programming. In: POPL (2008)Google Scholar
  18. 18.
    Nielson, F., Nielson, H.R.: Type and Effect Systems. In: Olderog, E.-R., Steffen, B. (eds.) Correct System Design. LNCS, vol. 1710, pp. 114–136. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  19. 19.
    Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer, Heidelberg (1999)MATHGoogle Scholar
  20. 20.
    Pierce, B.: Types and Programming Languages. The MIT Press (2002)Google Scholar
  21. 21.
    Pratikakis, P., Foster, J.S., Hicks, M.: Locksmith: context-sensitive correlation analysis for race detection. In: PLDI (2006)Google Scholar
  22. 22.
    Sadowski, C., Freund, S.N., Flanagan, C.: SingleTrack: A Dynamic Determinism Checker for Multithreaded Programs. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 394–409. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  23. 23.
    Salcianu, A., Rinard, M.C.: Pointer and escape analysis for multithreaded programs. In: PPOPP (2001)Google Scholar
  24. 24.
    Sutter, H., Larus, J.: Software and the concurrency revolution. Queue 3(7) (2005)Google Scholar
  25. 25.
    Terauchi, T., Aiken, A.: A capability calculus for concurrency and determinism. TOPLAS 30(5) (2008)Google Scholar
  26. 26.
    Vechev, M., Yahav, E., Raman, R., Sarkar, V.: Automatic Verification of Determinism for Structured Parallel Programs. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 455–471. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  27. 27.
    Xie, X., Xue, J.: Acculock: Accurate and efficient detection of data races. In: CGO (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Yi Lu
    • 1
  • John Potter
    • 1
  • Chenyi Zhang
    • 2
  • Jingling Xue
    • 1
  1. 1.University of New South WalesAustralia
  2. 2.University of QueenslandAustralia

Personalised recommendations