Skip to content

Concurrency in Reactions: Declarative multicore programming in Scala

License

Notifications You must be signed in to change notification settings

winitzki/chymyst-book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chymyst: declarative concurrency in Scala

Chymyst is a framework for declarative concurrency in functional programming implementing the Chemical Machine paradigm, also known in the academic world as Join Calculus. This concurrency paradigm has the same expressive power as CSP (Communicating Sequential Processes), the Pi calculus, and the Actor model, but is easier to use and reason about, more high-level, and more declarative.

Chymyst Core is a library that implements the high-level concurrency primitives as a domain-specific language in Scala. Chymyst is a framework-in-planning that will build upon Chymyst Core and bring declarative concurrency to practical applications.

The code of Chymyst Core is a clean-room implementation and is not based on previous Join Calculus implementations, such as ScalaJoin by He Jiansen (2011) and ScalaJoins by Philipp Haller (2008). The algorithm is similar to that used in my earlier Join Calculus prototypes, Objective-C/iOS and Java/Android.

Status of the project

The Chymyst Core library is in alpha pre-release, with very few API changes envisioned for the future.

The semantics of the chemical machine (restricted to single-host, multicore computations) is fully implemented and tested on many nontrivial examples.

The library JAR is published to Maven Central.

Extensive tutorial and usage documentation is available.

Unit tests (more than 500 at the moment) exercise all aspects of the DSL provided by Chymyst. Test coverage is 100% according to codecov.io.

Test suites also complement the tutorial book and include examples such as barriers, asynchronous and synchronous rendezvous, local critical sections, parallel “or”, parallel map/reduce, parallel merge-sort, “dining philosophers”, as well as many other concurrency algorithms.

Performance benchmarks indicate that Chymyst Core can schedule about 100,000 reactions per second per CPU core, and the performance bottleneck is in submitting jobs to threads (a distant second bottleneck is pattern-matching in the internals of the library).