chymyst-core

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.

The Concurrency in Reactions tutorial book: table of contents

Overview of Chymyst and the Chemical Machine paradigm

Concurrency in Reactions: Get started with this extensive tutorial book

From actors to reactions: a guide for those familiar with the Actor model

A “Hello, world” project

Presentations on Chymyst and on the Chemical Machine programming paradigm

See this YouTube channel for tutorials and presentations.

Oct. 16, 2017: Talk given at the Scala Bay meetup:

July 2017: Draft of an academic paper describing Chymyst and its approach to join calculus

Nov. 11, 2016: Talk given at Scalæ by the Bay 2016:

Main features of the chemical machine

Comparison of the chemical machine vs. academic Join Calculus

Comparison of the chemical machine vs. the Actor model

Comparison of the chemical machine vs. the coroutines / channels approach (CSP)

Technical documentation for Chymyst Core

Source code repository for Chymyst Core

Version history and roadmap

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).