Join-patterns provides a way to write concurrent, parallel and distributed computer programs by message passing. Compared to the use of threads and locks, this is a high level programming model using communication constructs model to abstract the complexity of concurrent environment and to allow scalability. Its focus is on the execution of a chord between messages atomically consumed from a group of channels. This template is based on join-calculus and uses pattern matching. Concretely, this is done by allowing the join definition of several functions and/or channels by matching concurrent call and messages patterns. It is a type of concurrency pattern because it makes easier and more flexible for these entities to communicate and deal with the multi-threaded programming paradigm.
Description The join-pattern (or a chord in Cω) is like a super pipeline with synchronisation and matching. In fact, this concept is summarise by match and join a set of message available from different message queues, then handles them all simultaneously with one handler. It could be represented by the keywords when to specify the first communication that we expected, with the and to join/pair other channels and the do to run some tasks with the different collected messages. A constructed join pattern typically takes this form:
Argument a1 of When(a1) may be a synchronous or asynchronous channel or an array of asynchronous channels. Each subsequent argument ai to And(ai) (for i > 1) must be an asynchronous channel. More precisely, when a message matches with a chain of linked patterns causes its handler to run (in a new thread if it's in asynchronous context) otherwise the message is queued until one of its patterns is enabled; if there are several matches, an unspecified pattern is selected. Unlike an event handler, which services one of several alternative events at a time, in conjunction with all other handlers on that event, a join pattern waits for a conjunction of channels and competes for execution with any other enabled pattern.
Join-pattern is defined by a set of pi-calculus channels x that supports two different operations, sending and receiving, we need two join calculus names to implement it: a channel name x for sending (a message), and a function name x for receiving a value (a request). The meaning of the join definition is that a call to x() returns a value that was sent on a channel x<>. Each time functions are concurrently, triggers the return process and synchronizes with other joins.
From a client’s perspective, a channel just declares a method of the same name and signature. The client posts a message or issues a request by invoking the channel as a method. A continuation method must wait until/unless a single request or message has arrived on each of the channels following the continuation’s When clause. If the continuation gets to run, the arguments of each channel invocation are dequeued (thus consumed) and transferred (atomically) to the continuation’s parameters.
In most of cases, the order of synchronous calls is not guaranteed for performance reasons. Finally, during the match the messages available in the queue could be stolen by some intervening thread; indeed, the awakened thread may have to wait again.
History
π-calculus – 1992 The π-calculus belongs to the family of process calculi, allows mathematical formalisms for describing and analyzing properties of concurrent computation by using channel names to be communicated along the channels themselves, and in this way it is able to describe concurrent computations whose network configuration may change during the computation.
Join-Calculus – 1993 Join patterns first appeared in Fournet and Gonthier’s foundational join-calculus, an asynchronous process algebra designed for efficient implementation in a distributed setting. The join-calculus is a process calculus as expressive as the full π-calculus. It was developed to provide a formal basis for the design of distributed programming languages, and therefore intentionally avoids communications constructs found in other process calculi, such as rendezvous communications.
Distributed Join-Calculus – 1996 The Join-Calculus is both a name passing calculus and a core language for concurrent and distributed programming. That's why the Distributed Join-Calculus based on the Join-Calculus with the distributed programming was created on 1996. This work use the mobile agents where agents are not only programs but core images of running processes with their communication capabilities.
JoCaml, Funnel and Join Java – 2000 JoCaml and Funnel are functional languages supporting declarative join patterns. They present the ideas to direct implement a process calculi in a functional setting. Another extensions to (non-generic) Java, JoinJava, were independently proposed by von Itzstein and Kearney.
Polyphonic C# – 2002 Cardelli, Benton and Fournet proposed an object-oriented version of join patterns for C# called Polyphonic C#.
Cω – 2003 Cω is adaptation of join-calculus to an object-oriented setting. This variant of Polyphonic C# was included in the public release of Cω (a.k.a. Comega) in 2004.
Scala Joins – 2007 Scala Joins is a library to use Join-Pattern with Scala in the context of extensible pattern matching in order to integrate joins into an existing actor-based concurrency framework.
JErlang – 2009 Erlang is a language which natively supports the concurrent, real time and distributed paradigm. Concurrency between processes was complex, that's why the project build a new language, JErlang (J stands for Join) using based on the Join-calculus.
Join-pattern in classic programming literature "Join-patterns can be used to easily encode related concurrency idioms like actors and active objects."
Barriers
Dining philosophers problem
Mutual exclusion
Producers/Consumers
Reader-writer locking
Semaphores
… excerpt ends here. Continue reading the full article.

