SHIM: A Deterministic Approach to Programming with Threads

Concurrent programming languages should be a good fit for embedded systems because they match the intrinsic parallelism of their architectures and environments. Unfortunately, most concurrent programming formalisms are prone to races and nondeterminism, despite the presence of mechanisms such as monitors. In this paper, we propose SHIM, the core of a concurrent language with disciplined shared variables that remains deterministic, meaning the behavior of a program is independent of the scheduling of concurrent operations. SHIM does not sacrifice power or flexibility to achieve this determinism. It supports both synchronous and asynchronous paradigms—loosely and tightly synchronized threads—the dynamic creation of threads and shared variables, recursive procedures, and exceptions. We illustrate our programming model with examples including breadth-first-search algorithms and pipelines. By construction, they are race-free. We provide the formal semantics of SHIM and a preliminary implementation.

[1]  James Cheney,et al.  Cyclone: A Safe Dialect of C , 2002, USENIX Annual Technical Conference, General Track.

[2]  Brian A. Wichmann,et al.  Rationale for the design of the Ada programming language , 1979, SIGP.

[3]  M. Burrows,et al.  Finding stale‐value errors in concurrent programs , 2004, Concurr. Pract. Exp..

[4]  Per Brinch Hansen,et al.  The programming language concurrent pascal , 1975, Language Hierarchies and Interfaces.

[5]  Albert Benveniste,et al.  The synchronous approach to reactive and real-time systems , 1991 .

[6]  Thomas Martyn Parks,et al.  Bounded scheduling of process networks , 1996 .

[7]  David F. Bacon,et al.  Guava: a dialect of Java without data races , 2000, OOPSLA '00.

[8]  Gérard Berry,et al.  Preemption in Concurrent Systems , 1993, FSTTCS.

[9]  Robin Milner,et al.  Communicating and mobile systems - the Pi-calculus , 1999 .

[10]  Christine Paulin-Mohring,et al.  The coq proof assistant reference manual , 2000 .

[11]  Frédéric Boussinot,et al.  FairThreads: mixing cooperative and preemptive threads in C , 2006, Concurr. Comput. Pract. Exp..

[12]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[13]  Rajiv Gupta,et al.  The efficiency of storage management schemes for Ada programs , 1985 .

[14]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multi-threaded programs , 1997, TOCS.

[15]  Gérard Berry,et al.  The Esterel Synchronous Programming Language: Design, Semantics, Implementation , 1992, Sci. Comput. Program..

[16]  Armin Biere,et al.  High‐level data races , 2003, Softw. Test. Verification Reliab..

[17]  Frank Tip,et al.  Associating synchronization constraints with data in an object-oriented language , 2006, POPL '06.

[18]  Rüdiger Reinecke,et al.  Hoares Communicating Sequential Processes: Erweiterung des Spurenmodells , 1985 .

[19]  Per Brinch Hansen,et al.  Monitors and concurrent Pascal: a personal history , 1993, HOPL-II.

[20]  Gilles Kahn,et al.  The Semantics of a Simple Language for Parallel Programming , 1974, IFIP Congress.

[21]  Gordon D. Plotkin,et al.  A structural approach to operational semantics , 2004, J. Log. Algebraic Methods Program..

[22]  Stephen N. Freund,et al.  Atomizer: A dynamic atomicity checker for multithreaded programs , 2008, Sci. Comput. Program..

[23]  Stephen A. Edwards,et al.  The synchronous languages 12 years later , 2003, Proc. IEEE.

[24]  Stephen A. Edwards,et al.  SHIM: a deterministic model for heterogeneous embedded systems , 2005, IEEE Transactions on Very Large Scale Integration (VLSI) Systems.

[25]  Jong-Deok Choi,et al.  Efficient and precise datarace detection for multithreaded object-oriented programs , 2002, PLDI '02.

[26]  George C. Necula,et al.  CCured: type-safe retrofitting of legacy code , 2002, POPL '02.

[27]  Cédric Fournet,et al.  The Join Calculus: A Language for Distributed Mobile Programming , 2000, APPSEM.

[28]  Martin C. Rinard,et al.  A parameterized type system for race-free Java programs , 2001, OOPSLA '01.

[29]  C. A. R. Hoare,et al.  Communicating sequential processes , 1978, CACM.

[30]  Cormac Flanagan,et al.  A type and effect system for atomicity , 2003, PLDI.

[31]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[32]  Gregory R. Andrews,et al.  Concepts and Notations for Concurrent Programming , 1983, CSUR.

[33]  Inmos Limited,et al.  OCCAM 2 reference manual , 1988 .

[34]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[35]  Ralph E. Griswold,et al.  The implementation of the Icon programming language , 1986 .