Static safety guarantees for a low-level multithreaded language with regions

We present the design of a formal low-level multithreaded language with advanced region-based memory management and thread synchronization primitives, where well-typed programs are memory safe and race free. In our language, regions and locks are combined in a single hierarchy and are subject to uniform ownership constraints imposed by this hierarchical structure: deallocating a region causes its sub-regions to be deallocated. Similarly, when a region is read/write-protected, then its sub-regions inherit the same access rights. We discuss aspects of the integration and implementation of the formal language within Cyclone and evaluate the performance of code produced by the modified Cyclone compiler against highly optimized C programs using pthreads. Our results show that the performance overhead for guaranteed race freedom and memory safety is in most cases acceptable.

[1]  Hans-Juergen Boehm,et al.  HP Laboratories , 2006 .

[2]  Anoop Gupta,et al.  Memory consistency and event ordering in scalable shared-memory multiprocessors , 1990, [1990] Proceedings. The 17th Annual International Symposium on Computer Architecture.

[3]  Wei Liu,et al.  Pillar: A Parallel Implementation Language , 2007, LCPC.

[4]  Fritz Henglein,et al.  A direct approach to control-flow sensitive region-based memory management , 2001, PPDP '01.

[5]  Mads Tofte,et al.  Implementation of the typed call-by-value λ-calculus using a stack of regions , 1994, POPL '94.

[6]  Dan Grossman,et al.  Safe manual memory management in Cyclone , 2006, Sci. Comput. Program..

[7]  Thomas R. Gross,et al.  A time-aware type system for data-race protection and guaranteed initialization , 2010, OOPSLA.

[8]  David Gay,et al.  Language support for regions , 2001, PLDI '01.

[9]  Jan Vitek,et al.  Scoped types for real-time Java , 2004, 25th IEEE International Real-Time Systems Symposium.

[10]  George C. Necula,et al.  Dependent Types for Low-Level Programming , 2007, ESOP.

[11]  Jeffrey Overbey,et al.  A type and effect system for deterministic parallel Java , 2009, OOPSLA 2009.

[12]  Alexander Aiken,et al.  Better static memory management: improving region-based analysis of higher-order languages , 1995, PLDI '95.

[13]  David Walker,et al.  On regions and linear types (extended abstract) , 2001, ICFP '01.

[14]  J. Gregory Morrisett,et al.  Linear Regions Are All You Need , 2006, ESOP.

[15]  Sophia Drossopoulou,et al.  Universes for Race Safety , 2007 .

[16]  Martin C. Rinard,et al.  Ownership types for safe region-based memory management in real-time Java , 2003, PLDI '03.

[17]  Mark D. Hill,et al.  Weak ordering—a new definition , 1998, ISCA '98.

[18]  Konstantinos Sagonas,et al.  Race-free and memory-safe multithreading: design and implementation in cyclone , 2010, TLDI '10.

[19]  Todd M. Austin,et al.  Efficient detection of all pointer and array access errors , 1994, PLDI '94.

[20]  Richard M. Stallman,et al.  Using the GNU Compiler Collection , 2010 .

[21]  Konstantinos Sagonas,et al.  A Concurrent Language with a Uniform Treatment of Regions and Locks , 2009, PLACES.

[22]  Adam Welc,et al.  Safe nondeterminism in a deterministic-by-default parallel language , 2011, POPL '11.

[23]  Jan Vitek,et al.  Implicit ownership types for memory management , 2008, Sci. Comput. Program..

[24]  George C. Necula,et al.  CCured: type-safe retrofitting of legacy software , 2005, TOPL.

[25]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[26]  Parosh Aziz Abdulla A Type and Effect System for Deadlock Avoidance in Low-level Languages , 2011 .

[27]  Dan Grossman,et al.  Type-safe multithreading in cyclone , 2003, TLDI '03.

[28]  David Walker,et al.  On Regions and Linear Types , 2001, ACM SIGPLAN International Conference on Functional Programming.

[29]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[30]  Leslie Lamport A New Approach to Proving the Correctness of Multiprocess Programs , 1979, TOPL.

[31]  Philip Levis,et al.  The nesC language: a holistic approach to networked embedded systems , 2003, SIGP.

[32]  Matteo Frigo,et al.  The implementation of the Cilk-5 multithreaded language , 1998, PLDI.

[33]  Martín Abadi,et al.  Object Types against Races , 1999, CONCUR.