Skip to main content
Log in

Region and effect inference for safe parallelism

  • Published:
Automated Software Engineering Aims and scope Submit manuscript

Abstract

In this paper, we present the first full regions-and-effects inference algorithm for explicitly parallel fork-join programs. We infer annotations equivalent to those in Deterministic Parallel Java (DPJ) for type-safe C++ programs. We chose the DPJ annotations because they give the strongest safety guarantees of any existing concurrency-checking approach we know of, static or dynamic, and it is also the most expressive static checking system we know of that gives strong safety guarantees. This expressiveness, however, makes manual annotation difficult and tedious, which motivates the need for automatic inference, but it also makes the inference problem very challenging: the code may use region polymorphism, imperative updates with complex aliasing, arbitrary recursion, hierarchical region specifications, and wildcard elements to describe potentially infinite sets of regions. We express the inference as a constraint satisfaction problem and develop, implement, and evaluate an algorithm for solving it. The region and effect annotations inferred by the algorithm constitute a checkable proof of safe parallelism, and it can be recorded both for documentation and for fast and modular safety checking.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Notes

  1. https://github.com/hanm/clang/tree/dev/prolog-full.

  2. http://clang.llvm.org/.

  3. https://www.threadingbuildingblocks.org/.

  4. https://bitbucket.org/atzannes/annotationinference.

  5. https://bitbucket.org/atzannes/annotationinference.

  6. https://www.threadingbuildingblocks.org/.

References

  • Aiken, A., Fähndrich, M., Levien, R.: Better static memory management: improving region-based analysis of higher-order languages. In: Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation (1995)

  • Allen, M.D., Sridharan, S., Sohi, G.S.: Serialization sets: a dynamic dependence-based parallel execution model. In: Proceedings of the 14th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (2009)

  • Andersen, L.O.: Program analysis and specialization for the C programming language. Ph.D. thesis, DIKU, University of Copenhagen (1994)

  • Anderson, Z., Gay, D., Ennals, R., Brewer, E.: SharC: checking data sharing strategies for multithreaded C. In: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (2008)

  • Artzi, S., Kieżun, A., Quinonez, J., Ernst, M.D.: Parameter reference immutability: formal definition, inference tool, and comparison. Autom. Softw. Eng. 16, 145–192 (2009)

    Article  Google Scholar 

  • Banning, J.P.: An efficient way to find the side effects of procedure calls and the aliases of variables. In: Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (1979)

  • Bergan, T., Anderson, O., Devietti, J., Ceze, L., Grossman, D.: CoreDet: a compiler and runtime system for deterministic multithreaded execution. In: Proceedings of the Fifteenth Edition of ASPLOS on Architectural Support for Programming Languages and Operating Systems (2010)

  • Bierman, G., Parkinson, M.: Effects and effect inference for a core Java calculus. Workshop on Object Oriented Developments (2003)

  • Bocchino, R.L., Adve, V.S.: Types, regions, and effects for safe programming with object-oriented parallel frameworks. In: Proceedings of the 25th European Conference on Object-Oriented Programming, Springer-Verlag, Berlin, Heidelberg, ECOOP’11, pp. 306–332 (2011)

  • Bocchino Jr, R.L.: An effect system and language for deterministic-by-default parallel programming. Ph.D. thesis, University of Illinois at Urbana-Champaign (2010)

  • 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: Proceedings of the 24th ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications (2009)

  • 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: Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (2011)

  • Cherem, S., Rugina, R.: Region analysis and transformation for java programs. In: Proceedings of the 4th International Symposium on Memory management, Vancouver, Canada (2004)

  • Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: Proceedings of the 13th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (1998)

  • Cunningham, D., Dietl, W., Drossopoulou, S., Francalanza, A., Müller, P., Summers, A.J.: Universe types for topology and encapsulation. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.P. (eds.) Formal Methods For Components And Objects, pp. 72–112. Springer, Berlin (2008)

    Chapter  Google Scholar 

  • De Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Proceedings of the Theory and Practice of Software, 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, Springer-Verlag, TACAS’08/ETAPS’08, pp. 337–340 (2008)

  • Dietl, W., Ernst, M.D., Müller, P.: Tunable static inference for generic universe types. In: Proceedings of the 25th European Conference on Object-Oriented Programming (2011)

  • Dymnikov, C., Pearce, D.J., Potanin, A. (2013) OwnKit: inferring modularly checkable ownership annotations for java. In: Proceedings of the 22nd Australian Conference on Software Engineering

  • Fähndrich, M., Foster, J.S., Su, Z., Aiken, A.: Partial online cycle elimination in inclusion constraint graphs. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation (1998)

  • Flanagan, C., Sabry, A., Duba, B.F., Felleisen, M.: The essence of compiling with continuations. In: Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, ACM, New York, NY, USA, pp. 237–247 (1993) https://doi.org/10.1145/155090.155113

  • Gordon, C.S., Parkinson, M.J., Parsons, J., Bromfield, A., Duffy, J.: Uniqueness and reference immutability for safe parallelism. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (2012)

  • Greenhouse, A., Boyland, J.: An object-oriented effects system. In: Proceedings of the 13th European Conference on Object-Oriented Programming, Springer-Verlag (1999)

  • Hardekopf, B., Lin, C.: The ant and the grasshopper: fast and accurate pointer analysis for millions of lines of code. In: Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation (2007)

  • Huang, W., Dietl, W., Milanova, A., Ernst, M.D.: Inference and checking of object ownership. In: Proceedings of the 26th European Conference on Object-Oriented Programming (2012a)

  • Huang, W., Milanova, A., Dietl, W., Ernst, M.D.: ReIm & ReImInfer: checking and inference of reference immutability and method purity. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (2012b)

  • Jouvelot, P., Gifford, D.: Algebraic reconstruction of types and effects. In: Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1991)

  • Kawaguchi, M., Rondon, P., Bakst, A., Jhala, R.: Deterministic parallelism via liquid effects. In: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation (2012)

  • Lee, E.A.: The problem with threads. Computer 39(5), 33–42 (2006)

    Article  Google Scholar 

  • Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1988)

  • Nguyen, P., Xue, J.: Interprocedural side-effect analysis for Java programs in the presence of dynamic class loading. In: Proceedings of the Twenty-eighth Australasian Conference on Computer Science, vol. 38 (2005)

  • Olszewski, M., Ansel, J., Amarasinghe, S.: Kendo: efficient deterministic multithreading in software. In: Proceedings of the 14th International Conference on Architectural Support for Programming Languages and Operating Systems (2009)

  • Pearce, D.J.: JPure: a modular purity system for Java. In: Compiler Construction, pp 104–123 (2011)

  • Quinonez, J., Tschantz, M.S., Ernst, M.D.: Inference of reference immutability. In: Proceedings of the 22nd European Conference on Object-Oriented Programming, pp 616–641 (2008)

  • Rinard, M.C., Lam, M.S.: The design, implementation, and evaluation of Jade. ACM Trans. Program. Lang. Syst. 20(3), 483–545 (1998)

    Article  Google Scholar 

  • Rondon, P.M., Kawaguchi, M., Jhala, R.: Low-level liquid types. In: Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (2010)

  • Rountev, A.: Precise identification of side-effect-free methods in java. In: Proceedings of the 20th IEEE International Conference on Software Maintenance (2004)

  • Rountev, A., Chandra, S.: Off-line variable substitution for scaling points-to analysis. In: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (2000)

  • Ryder, B.G., Landi, W.A., Stocks, P.A., Zhang, S., Altucher, R.: A schema for interprocedural modification side-effect analysis with pointer aliasing. ACM Trans. Program. Lang. Syst. 23(2), 105–186 (2001)

    Article  Google Scholar 

  • Sabry, A., Felleisen, M.: Reasoning about programs in continuation-passing style. Lisp Symb. Comput. Spec. Issue Contin. Part I 6(3–4), 289–360 (1993)

    Google Scholar 

  • Salcianu, A., Rinard, M.C.: Purity and side effect analysis for Java programs. In: Proceedings of the 6th International Conference on Verification, Model Checking, and Abstract Interpretation (2005)

  • Talpin, J.P., Jouvelot, P.: Polymorphic type, region and effect inference. J. Funct. Program. 2, 245–271 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  • Tofte, M., Birkedal, L.: A region inference algorithm. ACM Trans. Program. Lang. Syst. 20(4), 724–767 (1998)

    Article  MATH  Google Scholar 

  • Tofte, M., Talpin, J.P.: Implementation of the typed call-by-value \(\lambda \)-calculus using a stack of regions. In: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1994)

  • Treichler, S., Bauer, M., Aiken, A.: Language support for dynamic, hierarchical data partitioning. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications (2013)

  • Vakilian, M., Dig, D., Bocchino, R., Overbey, J., Adve, V., Johnson, R.: Inferring method effect summaries for nested heap regions. In: Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering (2009)

Download references

Funding

Funding was provided by Directorate for Computer and Information Science and Engineering (Grant No. NSF CNS 07-20772) and Intel Illinois Parallel Computing Center (I2PC).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexandros Tzannes.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Tzannes, A., Heumann, S.T., Eloussi, L. et al. Region and effect inference for safe parallelism. Autom Softw Eng 26, 463–509 (2019). https://doi.org/10.1007/s10515-019-00257-3

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10515-019-00257-3

Keywords

Navigation