<s>
Join-patterns	B-Operating_System
provides	O
a	O
way	O
to	O
write	O
concurrent	B-Operating_System
,	O
parallel	B-Operating_System
and	O
distributed	B-Architecture
computer	O
programs	O
by	O
message	B-Architecture
passing	I-Architecture
.	O
</s>
<s>
Compared	O
to	O
the	O
use	O
of	O
threads	B-Operating_System
and	O
locks	O
,	O
this	O
is	O
a	O
high	O
level	O
programming	O
model	O
using	O
communication	O
constructs	O
model	O
to	O
abstract	O
the	O
complexity	O
of	O
concurrent	B-Operating_System
environment	O
and	O
to	O
allow	O
scalability	B-Architecture
.	O
</s>
<s>
Its	O
focus	O
is	O
on	O
the	O
execution	O
of	O
a	O
chord	B-Operating_System
between	O
messages	O
atomically	O
consumed	O
from	O
a	O
group	O
of	O
channels	O
.	O
</s>
<s>
This	O
template	O
is	O
based	O
on	O
join-calculus	B-Language
and	O
uses	O
pattern	B-Language
matching	I-Language
.	O
</s>
<s>
Concretely	O
,	O
this	O
is	O
done	O
by	O
allowing	O
the	O
join	O
definition	O
of	O
several	O
functions	O
and/or	O
channels	O
by	O
matching	O
concurrent	B-Operating_System
call	O
and	O
messages	O
patterns	O
.	O
</s>
<s>
It	O
is	O
a	O
type	O
of	O
concurrency	B-Operating_System
pattern	I-Operating_System
because	O
it	O
makes	O
easier	O
and	O
more	O
flexible	O
for	O
these	O
entities	O
to	O
communicate	O
and	O
deal	O
with	O
the	O
multi-threaded	B-Operating_System
programming	I-Operating_System
paradigm	O
.	O
</s>
<s>
The	O
join-pattern	B-Operating_System
(	O
or	O
a	O
chord	B-Operating_System
in	O
Cω	B-Language
)	O
is	O
like	O
a	O
super	O
pipeline	O
with	O
synchronisation	O
and	O
matching	O
.	O
</s>
<s>
In	O
fact	O
,	O
this	O
concept	O
is	O
summarise	O
by	O
match	O
and	O
join	O
a	O
set	O
of	O
message	O
available	O
from	O
different	O
message	B-Operating_System
queues	I-Operating_System
,	O
then	O
handles	O
them	O
all	O
simultaneously	O
with	O
one	O
handler	O
.	O
</s>
<s>
Argument	O
of	O
may	O
be	O
a	O
synchronous	B-Architecture
or	O
asynchronous	B-Architecture
channel	B-Device
or	O
an	O
array	O
of	O
asynchronous	B-Architecture
channels	O
.	O
</s>
<s>
Each	O
subsequent	O
argument	O
to	O
(	O
for	O
)	O
must	O
be	O
an	O
asynchronous	B-Architecture
channel	B-Device
.	O
</s>
<s>
More	O
precisely	O
,	O
when	O
a	O
message	O
matches	O
with	O
a	O
chain	O
of	O
linked	O
patterns	O
causes	O
its	O
handler	O
to	O
run	O
(	O
in	O
a	O
new	O
thread	B-Operating_System
if	O
it	O
's	O
in	O
asynchronous	B-Architecture
context	O
)	O
otherwise	O
the	O
message	O
is	O
queued	O
until	O
one	O
of	O
its	O
patterns	O
is	O
enabled	O
;	O
if	O
there	O
are	O
several	O
matches	O
,	O
an	O
unspecified	O
pattern	O
is	O
selected	O
.	O
</s>
<s>
Join-pattern	B-Operating_System
is	O
defined	O
by	O
a	O
set	O
of	O
pi-calculus	O
channels	O
that	O
supports	O
two	O
different	O
operations	O
,	O
sending	O
and	O
receiving	O
,	O
we	O
need	O
two	O
join	B-Language
calculus	I-Language
names	O
to	O
implement	O
it	O
:	O
a	O
channel	B-Device
name	O
for	O
sending	O
(	O
a	O
message	O
)	O
,	O
and	O
a	O
function	O
name	O
for	O
receiving	O
a	O
value	O
(	O
a	O
request	O
)	O
.	O
</s>
<s>
The	O
meaning	O
of	O
the	O
join	O
definition	O
is	O
that	O
a	O
call	O
to	O
returns	O
a	O
value	O
that	O
was	O
sent	O
on	O
a	O
channel	B-Device
.	O
</s>
<s>
Each	O
time	O
functions	O
are	O
concurrently	O
,	O
triggers	O
the	O
return	O
process	O
and	O
synchronizes	O
with	O
other	O
joins	B-Library
.	O
</s>
<s>
{{	O
quote|From	O
a	O
client	O
’s	O
perspective	O
,	O
a	O
channel	B-Device
just	O
declares	O
a	O
method	O
of	O
the	O
same	O
name	O
and	O
signature	O
.	O
</s>
<s>
The	O
client	O
posts	O
a	O
message	O
or	O
issues	O
a	O
request	O
by	O
invoking	O
the	O
channel	B-Device
as	O
a	O
method	O
.	O
</s>
<s>
In	O
most	O
of	O
cases	O
,	O
the	O
order	O
of	O
synchronous	B-Architecture
calls	O
is	O
not	O
guaranteed	O
for	O
performance	O
reasons	O
.	O
</s>
<s>
Finally	O
,	O
during	O
the	O
match	O
the	O
messages	O
available	O
in	O
the	O
queue	O
could	O
be	O
stolen	O
by	O
some	O
intervening	O
thread	B-Operating_System
;	O
indeed	O
,	O
the	O
awakened	O
thread	B-Operating_System
may	O
have	O
to	O
wait	O
again	O
.	O
</s>
<s>
The	O
π-calculus	O
belongs	O
to	O
the	O
family	O
of	O
process	O
calculi	O
,	O
allows	O
mathematical	O
formalisms	O
for	O
describing	O
and	O
analyzing	O
properties	O
of	O
concurrent	B-Architecture
computation	I-Architecture
by	O
using	O
channel	B-Device
names	O
to	O
be	O
communicated	O
along	O
the	O
channels	O
themselves	O
,	O
and	O
in	O
this	O
way	O
it	O
is	O
able	O
to	O
describe	O
concurrent	B-Architecture
computations	I-Architecture
whose	O
network	O
configuration	O
may	O
change	O
during	O
the	O
computation	O
.	O
</s>
<s>
Join	O
patterns	O
first	O
appeared	O
in	O
Fournet	O
and	O
Gonthier	O
’s	O
foundational	O
join-calculus	B-Language
,	O
an	O
asynchronous	B-Architecture
process	O
algebra	O
designed	O
for	O
efficient	O
implementation	O
in	O
a	O
distributed	B-Architecture
setting	O
.	O
</s>
<s>
The	O
join-calculus	B-Language
is	O
a	O
process	O
calculus	O
as	O
expressive	O
as	O
the	O
full	O
π-calculus	O
.	O
</s>
<s>
It	O
was	O
developed	O
to	O
provide	O
a	O
formal	O
basis	O
for	O
the	O
design	O
of	O
distributed	B-Architecture
programming	I-Architecture
languages	O
,	O
and	O
therefore	O
intentionally	O
avoids	O
communications	O
constructs	O
found	O
in	O
other	O
process	O
calculi	O
,	O
such	O
as	O
rendezvous	B-Operating_System
communications	O
.	O
</s>
<s>
The	O
Join-Calculus	B-Language
is	O
both	O
a	O
name	O
passing	O
calculus	O
and	O
a	O
core	O
language	O
for	O
concurrent	B-Operating_System
and	O
distributed	B-Architecture
programming	I-Architecture
.	O
</s>
<s>
That	O
's	O
why	O
the	O
Distributed	B-Architecture
Join-Calculus	B-Language
based	O
on	O
the	O
Join-Calculus	B-Language
with	O
the	O
distributed	B-Architecture
programming	I-Architecture
was	O
created	O
on	O
1996	O
.	O
</s>
<s>
This	O
work	O
use	O
the	O
mobile	B-Operating_System
agents	I-Operating_System
where	O
agents	O
are	O
not	O
only	O
programs	O
but	O
core	O
images	O
of	O
running	O
processes	O
with	O
their	O
communication	O
capabilities	O
.	O
</s>
<s>
JoCaml	B-Language
and	O
Funnel	O
are	O
functional	B-Language
languages	I-Language
supporting	O
declarative	O
join	O
patterns	O
.	O
</s>
<s>
They	O
present	O
the	O
ideas	O
to	O
direct	O
implement	O
a	O
process	O
calculi	O
in	O
a	O
functional	B-Language
setting	O
.	O
</s>
<s>
Another	O
extensions	O
to	O
(	O
non-generic	O
)	O
Java	B-Language
,	O
JoinJava	B-Language
,	O
were	O
independently	O
proposed	O
by	O
von	O
Itzstein	O
and	O
Kearney	O
.	O
</s>
<s>
Cardelli	O
,	O
Benton	O
and	O
Fournet	O
proposed	O
an	O
object-oriented	O
version	O
of	O
join	O
patterns	O
for	O
C#	O
called	O
Polyphonic	B-Language
C#	I-Language
.	O
</s>
<s>
Cω	B-Language
is	O
adaptation	O
of	O
join-calculus	B-Language
to	O
an	O
object-oriented	O
setting	O
.	O
</s>
<s>
This	O
variant	O
of	O
Polyphonic	B-Language
C#	I-Language
was	O
included	O
in	O
the	O
public	O
release	O
of	O
Cω	B-Language
(	O
a.k.a.	O
</s>
<s>
Comega	B-Language
)	O
in	O
2004	O
.	O
</s>
<s>
Scala	O
Joins	B-Library
is	O
a	O
library	O
to	O
use	O
Join-Pattern	B-Operating_System
with	O
Scala	O
in	O
the	O
context	O
of	O
extensible	O
pattern	B-Language
matching	I-Language
in	O
order	O
to	O
integrate	O
joins	B-Library
into	O
an	O
existing	O
actor-based	O
concurrency	B-Architecture
framework	O
.	O
</s>
<s>
Erlang	B-Operating_System
is	O
a	O
language	O
which	O
natively	O
supports	O
the	O
concurrent	B-Operating_System
,	O
real	O
time	O
and	O
distributed	B-Architecture
paradigm	O
.	O
</s>
<s>
Concurrency	B-Architecture
between	O
processes	O
was	O
complex	O
,	O
that	O
's	O
why	O
the	O
project	O
build	O
a	O
new	O
language	O
,	O
JErlang	O
(	O
J	O
stands	O
for	O
Join	O
)	O
using	O
based	O
on	O
the	O
Join-calculus	B-Language
.	O
</s>
<s>
"	O
Join-patterns	B-Operating_System
can	O
be	O
used	O
to	O
easily	O
encode	O
related	O
concurrency	B-Architecture
idioms	O
like	O
actors	O
and	O
active	O
objects.	O
"	O
</s>
<s>
public	O
readonly	O
Synchronous.Channel	O
Arrive	O
;	O
</s>
<s>
Synchronous.Channel[]	O
hungry	O
;	O
</s>
<s>
Asynchronous.Channel[]	O
chopstick	O
;	O
</s>
<s>
public	O
readonly	O
Synchronous.Channel	O
Acquire	O
;	O
</s>
<s>
public	O
readonly	O
Asynchronous.Channel	O
Release	O
;	O
</s>
<s>
public	O
readonly	O
Asynchronous.Channelxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
Put	O
;	O
</s>
<s>
public	O
readonly	O
Synchronousxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1.Channel	O
Get	O
;	O
</s>
<s>
private	O
readonly	O
Asynchronous.Channel	O
idle	O
;	O
</s>
<s>
private	O
readonly	O
Asynchronous.Channelxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
shared	O
;	O
</s>
<s>
public	O
readonly	O
Synchronous.Channel	O
AcqR	O
,	O
AcqW	O
,	O
RelR	O
,	O
RelW	O
;	O
</s>
<s>
public	O
readonly	O
Synchronous.Channel	O
Acquire	O
;	O
</s>
<s>
public	O
readonly	O
Asynchronous.Channel	O
Release	O
;	O
</s>
<s>
Join-calculus	B-Language
:	O
The	O
first	O
apparition	O
of	O
the	O
Join-Pattern	B-Operating_System
comes	O
out	O
with	O
this	O
process	O
calculus	O
.	O
</s>
<s>
Message	B-Architecture
passing	I-Architecture
:	O
Join-pattern	B-Operating_System
works	O
with	O
a	O
message	B-Architecture
passing	I-Architecture
system	O
for	O
parallel	B-Operating_System
reason	O
.	O
</s>
<s>
Channel	B-Device
:	O
Channels	O
are	O
used	O
to	O
synchronize	O
and	O
pass	O
messages	O
between	O
concurrently	O
executing	O
threads	B-Operating_System
.	O
</s>
<s>
In	O
general	O
,	O
a	O
channel	B-Device
may	O
be	O
involved	O
in	O
more	O
than	O
one	O
join	O
pattern	O
,	O
each	O
pattern	O
defines	O
a	O
different	O
continuation	O
that	O
may	O
run	O
when	O
the	O
channel	B-Device
is	O
invoked	O
.	O
</s>
<s>
Synchronous	B-Architecture
:	O
The	O
join-pattern	B-Operating_System
could	O
use	O
a	O
synchronous	B-Architecture
channel	B-Device
which	O
return	O
a	O
result	O
.	O
</s>
<s>
The	O
continuation	O
of	O
a	O
synchronous	B-Architecture
pattern	O
runs	O
in	O
the	O
thread	B-Operating_System
of	O
the	O
synchronous	B-Architecture
sender	O
.	O
</s>
<s>
Asynchronous	B-Architecture
:	O
It	O
could	O
also	O
use	O
an	O
asynchronous	B-Architecture
channel	B-Device
which	O
return	O
no	O
result	O
but	O
take	O
arguments	O
.	O
</s>
<s>
The	O
continuation	O
of	O
an	O
asynchronous	B-Architecture
pattern	O
runs	O
in	O
a	O
newly	O
spawned	O
thread	B-Operating_System
.	O
</s>
<s>
A	O
join	O
pattern	O
may	O
be	O
purely	O
asynchronous	B-Architecture
,	O
provided	O
its	O
continuation	O
is	O
a	O
subroutine	O
and	O
its	O
When	O
clause	O
only	O
lists	O
asynchronous	B-Architecture
channels	O
.	O
</s>
<s>
Combine	O
synchronous	B-Architecture
and	O
asynchronous	B-Architecture
:	O
Merging	O
the	O
declarations	O
of	O
synchronous	B-Architecture
and	O
asynchronous	B-Architecture
buffer	O
would	O
yield	O
a	O
module	O
that	O
supports	O
the	O
two	O
communication	O
type	O
of	O
consumers	O
.	O
</s>
<s>
Design	O
patterns	O
:	O
The	O
join-pattern	B-Operating_System
is	O
first	O
of	O
all	O
a	O
behavioral	O
and	O
a	O
concurrency	B-Operating_System
pattern	I-Operating_System
.	O
</s>
<s>
Concurrent	B-Architecture
programming	I-Architecture
:	O
It	O
's	O
execute	O
in	O
a	O
concurrent	B-Operating_System
way	O
.	O
</s>
<s>
Pattern	B-Language
matching	I-Language
:	O
The	O
join-pattern	B-Operating_System
works	O
with	O
matching	O
tasks	O
.	O
</s>
<s>
Parallel	B-Operating_System
programming	I-Operating_System
:	O
It	O
performs	O
tasks	O
in	O
parallel	B-Operating_System
.	O
</s>
<s>
Distributed	B-Architecture
programming	I-Architecture
:	O
Jobs	O
could	O
be	O
scatter	O
on	O
different	O
agent	O
and	O
environments	O
with	O
this	O
pattern	O
.	O
</s>
<s>
Software	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
:	O
Software	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
(	O
STM	O
)	O
is	O
one	O
of	O
the	O
possible	O
implementation	O
for	O
the	O
communications	O
between	O
joint	O
.	O
</s>
<s>
A	O
mobile	B-Operating_System
agent	I-Operating_System
is	O
an	O
autonomous	O
software	O
agent	O
with	O
a	O
certain	O
social	O
ability	O
and	O
most	O
importantly	O
,	O
mobility	O
.	O
</s>
<s>
The	O
mobile	B-Operating_System
agents	I-Operating_System
can	O
be	O
used	O
to	O
match	O
concurrency	B-Architecture
and	O
distribution	O
if	O
one	O
uses	O
the	O
Join-calculus	B-Language
.	O
</s>
<s>
That	O
's	O
why	O
a	O
new	O
concept	O
named	O
"	O
distributed	B-Architecture
Join-calculus	B-Language
"	O
was	O
created	O
;	O
it	O
's	O
an	O
extension	O
of	O
Join-calculus	B-Language
with	O
locations	O
and	O
primitives	O
to	O
describe	O
the	O
mobility	O
.	O
</s>
<s>
Thanks	O
to	O
the	O
Join-calculus	B-Language
,	O
one	O
location	O
can	O
be	O
moved	O
atomically	O
to	O
another	O
site	O
.	O
</s>
<s>
The	O
processes	O
of	O
an	O
agent	O
is	O
specified	O
as	O
a	O
set	O
which	O
define	O
its	O
functionality	O
including	O
asynchronous	B-Architecture
emission	O
of	O
a	O
message	O
,	O
migration	O
to	O
other	O
location	O
.	O
</s>
<s>
But	O
with	O
the	O
join-calculus	B-Language
a	O
problem	O
with	O
a	O
location	O
can	O
be	O
detected	O
at	O
any	O
other	O
running	O
location	O
,	O
allowing	O
error	O
recovery	O
.	O
</s>
<s>
In	O
2007	O
,	O
an	O
extension	O
of	O
the	O
basic	O
join	B-Language
calculus	I-Language
with	O
methods	O
which	O
make	O
agents	O
proactive	O
has	O
come	O
out	O
.	O
</s>
<s>
Join-languages	O
are	O
built	O
on	O
top	O
of	O
the	O
join-calculus	B-Language
taken	O
as	O
a	O
core	O
language	O
.	O
</s>
<s>
So	O
all	O
the	O
calculus	O
are	O
analysed	O
with	O
asynchronous	B-Architecture
processes	O
and	O
the	O
join	O
pattern	O
provides	O
a	O
model	O
to	O
synchronize	O
the	O
result	O
.	O
</s>
<s>
Jocaml	B-Language
Compiler	O
:	O
A	O
compiler	O
of	O
an	O
extension	O
of	O
Objectif	O
Caml	O
created	O
to	O
use	O
the	O
join	B-Language
calculus	I-Language
.	O
</s>
<s>
So	O
in	O
the	O
join-calculus	B-Language
,	O
the	O
basic	O
values	O
are	O
the	O
names	O
like	O
on	O
the	O
example	O
is	O
A	O
,	O
B	O
or	O
C	O
.	O
So	O
the	O
two	O
compiler	O
representing	O
this	O
values	O
with	O
two	O
ways	O
.	O
</s>
<s>
Jocaml	B-Language
use	O
name	O
like	O
a	O
pointer	O
on	O
definitions	O
.	O
</s>
<s>
Recent	O
research	O
describe	O
the	O
compilation	O
scheme	B-Language
as	O
the	O
combination	O
of	O
two	O
basic	O
steps	O
:	O
dispatching	O
and	O
forwarding	O
.	O
</s>
<s>
The	O
design	O
and	O
correctness	O
of	O
the	O
dispatcher	O
essentially	O
stems	O
from	O
pattern	B-Language
matching	I-Language
theory	O
,	O
while	O
inserting	O
an	O
internal	O
forwarding	O
step	O
in	O
communications	O
is	O
a	O
natural	O
idea	O
,	O
which	O
intuitively	O
does	O
not	O
change	O
process	O
behavior	O
.	O
</s>
<s>
They	O
made	O
the	O
observation	O
that	O
the	O
worth	O
observing	O
is	O
a	O
direct	O
implementation	O
of	O
extended	O
join-pattern	B-Operating_System
matching	O
at	O
the	O
runtime	O
level	O
would	O
significantly	O
complicate	O
the	O
management	O
of	O
message	B-Operating_System
queues	I-Operating_System
,	O
which	O
would	O
then	O
need	O
to	O
be	O
scanned	O
in	O
search	O
of	O
matching	O
messages	O
before	O
consuming	O
them	O
.	O
</s>
<s>
There	O
are	O
many	O
uses	O
of	O
the	O
Join-patterns	B-Operating_System
with	O
different	O
languages	O
.	O
</s>
<s>
Some	O
languages	O
use	O
join-patterns	B-Operating_System
as	O
a	O
base	O
of	O
theirs	O
implementations	O
,	O
for	O
example	O
the	O
Polyphonic	B-Language
C#	I-Language
or	O
MC#	O
but	O
others	O
languages	O
integrate	O
join-pattern	B-Operating_System
by	O
a	O
library	O
like	O
Scala	O
Joins	B-Library
for	O
Scala	O
or	O
the	O
Joins	B-Library
library	I-Library
for	O
VB	O
.	O
</s>
<s>
Moreover	O
,	O
the	O
join-pattern	B-Operating_System
is	O
used	O
through	O
some	O
languages	O
like	O
Scheme	B-Language
to	O
upgrade	O
the	O
join-pattern	B-Operating_System
.	O
</s>
<s>
Join	B-Language
Java	I-Language
is	O
a	O
language	O
based	O
on	O
the	O
Java	B-Language
programming	I-Language
language	I-Language
allowing	O
the	O
use	O
of	O
the	O
join	B-Language
calculus	I-Language
.	O
</s>
<s>
If	O
the	O
return	O
type	O
is	O
a	O
standard	O
Java	B-Language
type	O
then	O
the	O
leading	O
fragment	O
will	O
block	O
the	O
caller	O
until	O
the	O
Join	O
pattern	O
is	O
complete	O
and	O
the	O
method	O
has	O
executed	O
.	O
</s>
<s>
All	O
trailing	O
fragments	O
are	O
asynchronous	B-Architecture
so	O
will	O
not	O
block	O
the	O
caller	O
.	O
</s>
<s>
Asynchronous	B-Architecture
methods	O
are	O
defined	O
by	O
using	O
the	O
signal	O
return	O
type	O
.	O
</s>
<s>
When	O
an	O
asynchronous	B-Architecture
method	O
is	O
called	O
a	O
new	O
thread	B-Operating_System
is	O
created	O
to	O
execute	O
the	O
body	O
of	O
the	O
method	O
.	O
</s>
<s>
The	O
closest	O
related	O
language	O
is	O
the	O
Polyphonic	B-Language
C#	I-Language
.	O
</s>
<s>
In	O
Erlang	B-Operating_System
coding	O
synchronisation	O
between	O
multiple	O
processes	O
is	O
not	O
straightforward	O
.	O
</s>
<s>
JErlang	O
,	O
an	O
extension	O
of	O
Erlang	B-Operating_System
was	O
created	O
,	O
The	O
J	O
is	O
for	O
Join	O
.	O
</s>
<s>
Indeed	O
,	O
To	O
overcome	O
this	O
limitation	O
JErlang	O
was	O
implemented	O
,	O
a	O
Join-Calculus	B-Language
inspired	O
extension	O
to	O
Erlang	B-Operating_System
.	O
</s>
<s>
Joins	B-Library
allows	O
first	O
Match	O
semantics	O
and	O
the	O
possibility	O
of	O
having	O
multiple	O
patterns	O
with	O
a	O
preservation	O
of	O
the	O
messages	O
's	O
order	O
.	O
</s>
<s>
Yigong	O
Liu	O
has	O
written	O
some	O
classes	O
for	O
the	O
join	O
pattern	O
including	O
all	O
useful	O
tools	O
like	O
asynchronous	B-Architecture
and	O
synchronous	B-Architecture
channels	O
,	O
chords	B-Operating_System
,	O
etc	O
.	O
</s>
<s>
It	O
's	O
integrated	O
in	O
the	O
project	O
Boost	B-Language
c++	I-Language
.	O
</s>
<s>
chord( get	O
,	O
put	O
,	O
&	O
buffer::chord_body	O
)	O
;	O
</s>
<s>
This	O
example	O
shows	O
us	O
a	O
thread	B-Operating_System
safe	O
buffer	O
and	O
message	B-Operating_System
queue	I-Operating_System
with	O
the	O
basic	O
operations	O
put	O
and	O
get	O
.	O
</s>
<s>
Polyphonic	B-Language
C#	I-Language
is	O
an	O
extension	O
of	O
the	O
C#	O
programming	O
language	O
.	O
</s>
<s>
It	O
introduces	O
a	O
new	O
concurrency	B-Architecture
model	O
with	O
synchronous	B-Architecture
and	O
asynchronous	B-Architecture
(	O
which	O
return	O
control	O
to	O
the	O
caller	O
)	O
methods	O
and	O
chords	B-Operating_System
(	O
also	O
known	O
as	O
‘	O
synchronization	O
patterns’	O
or	O
‘	O
join	O
patterns’	O
)	O
.	O
</s>
<s>
MC#	O
language	O
is	O
an	O
adaptation	O
of	O
the	O
Polyphonic	B-Language
C#	I-Language
language	O
for	O
the	O
case	O
of	O
concurrent	B-Operating_System
distributed	B-Architecture
computations	I-Architecture
.	O
</s>
<s>
This	O
example	O
demonstrates	O
the	O
using	O
of	O
chords	B-Operating_System
as	O
a	O
synchronization	O
tool	O
.	O
</s>
<s>
Parallel	O
C#	O
is	O
based	O
Polyphonic	B-Language
C#	I-Language
and	O
they	O
add	O
some	O
new	O
concepts	O
like	O
movables	O
methods	O
,	O
high-order	O
functions	O
.	O
</s>
<s>
This	O
example	O
demonstrates	O
how	O
to	O
use	O
joins	B-Library
.	O
</s>
<s>
Cω	B-Language
adds	O
new	O
language	O
features	O
to	O
support	O
concurrent	B-Architecture
programming	I-Architecture
(	O
based	O
on	O
the	O
earlier	O
Polyphonic	B-Language
C#	I-Language
)	O
.	O
</s>
<s>
The	O
Joins	B-Library
Concurrency	B-Architecture
Library	O
for	O
C#	O
and	O
other	O
.NET	O
languages	O
is	O
derived	O
of	O
this	O
project	O
.	O
</s>
<s>
It	O
's	O
an	O
easy	O
to	O
use	O
declarative	O
and	O
scalable	B-Architecture
join-pattern	B-Operating_System
library	O
.	O
</s>
<s>
In	O
fact	O
,	O
it	O
's	O
working	O
with	O
a	O
compare-and-swap	B-Operating_System
CAS	O
and	O
Atomic	O
message	O
system	O
.	O
</s>
<s>
The	O
library	O
use	O
three	O
improvements	O
for	O
the	O
join-pattern	B-Operating_System
:	O
</s>
<s>
A	O
status	O
"	O
WOKEN	O
"	O
:	O
ensures	O
that	O
a	O
blocked	O
synchronous	B-Architecture
caller	O
is	O
woken	O
only	O
once	O
.	O
</s>
<s>
JoCaml	B-Language
is	O
the	O
first	O
language	O
where	O
the	O
join-pattern	B-Operating_System
was	O
implemented	O
.	O
</s>
<s>
Indeed	O
,	O
at	O
the	O
beginning	O
all	O
the	O
different	O
implementation	O
was	O
compiled	O
with	O
the	O
JoCaml	B-Language
Compiler	O
.	O
</s>
<s>
JoCaml	B-Language
language	O
is	O
an	O
extension	O
of	O
the	O
OCaml	B-Language
language	O
.	O
</s>
<s>
It	O
extends	O
OCaml	B-Language
with	O
support	O
for	O
concurrency	B-Architecture
and	O
synchronization	O
,	O
the	O
distributed	B-Architecture
execution	O
of	O
programs	O
,	O
and	O
the	O
dynamic	O
relocation	O
of	O
active	O
program	O
fragments	O
during	O
execution	O
.	O
</s>
<s>
*	O
0	O
in	O
an	O
asynchronous	B-Architecture
message	O
position	O
means	O
STOP	O
(	O
"	O
no	O
sent	O
message	O
"	O
in	O
CSP	O
terminology	O
)	O
.	O
</s>
<s>
HumeHammond/Michaelson/Sun	O
–	O
Programming	O
reactive	O
systems	O
in	O
Hume	B-Language
is	O
a	O
strict	B-Application
,	O
strongly	O
typed	O
functional	B-Language
language	I-Language
for	O
limited	O
resources	O
platforms	O
,	O
with	O
concurrency	B-Architecture
based	O
on	O
asynchronous	B-Architecture
message	B-Architecture
passing	I-Architecture
,	O
dataflow	B-Application
programming	I-Application
,	O
and	O
a	O
Haskell	B-Language
like	O
syntax	O
.	O
</s>
<s>
Hume	B-Language
does	O
not	O
provide	O
synchronous	B-Architecture
messaging	O
.	O
</s>
<s>
It	O
wraps	O
a	O
join-pattern	B-Operating_System
set	O
with	O
a	O
channel	B-Device
in	O
common	O
as	O
a	O
box	O
,	O
listing	O
all	O
channels	O
in	O
an	O
in	O
tuple	O
and	O
specifying	O
all	O
possible	O
outputs	O
in	O
an	O
out	O
tuple	O
.	O
</s>
<s>
Every	O
join-pattern	B-Operating_System
in	O
the	O
set	O
must	O
conform	O
to	O
the	O
box	O
input	O
tuple	O
type	O
specifying	O
a	O
'	O
*	O
 '	O
for	O
non	O
required	O
channels	O
,	O
giving	O
an	O
expression	O
whose	O
type	O
conform	O
to	O
the	O
output	O
tuple	O
,	O
marking	O
'	O
*	O
 '	O
the	O
non	O
fed	O
outputs	O
.	O
</s>
<s>
An	O
extension	O
of	O
Visual	O
Basic	O
9.0	O
with	O
asynchronous	B-Architecture
concurrency	B-Architecture
constructs	O
,	O
called	O
Concurrent	B-Operating_System
Basic	O
(	O
for	O
short	O
CB	O
)	O
,	O
offer	O
the	O
join	O
patterns	O
.	O
</s>
<s>
CB	O
(	O
builds	O
on	O
earlier	O
work	O
on	O
Polyphonic	B-Language
C#	I-Language
,	O
Cω	B-Language
and	O
the	O
Joins	B-Library
Library	I-Library
)	O
adopts	O
a	O
simple	O
event-like	O
syntax	O
familiar	O
to	O
VB	O
programmers	O
,	O
allows	O
one	O
to	O
declare	O
generic	O
concurrency	B-Architecture
abstractions	O
and	O
provides	O
more	O
natural	O
support	O
for	O
inheritance	O
,	O
enabling	O
a	O
subclass	O
to	O
augment	O
the	O
set	O
of	O
patterns	O
.	O
</s>
<s>
CB	O
class	O
can	O
declare	O
method	O
to	O
execute	O
when	O
communication	O
has	O
occurred	O
on	O
a	O
particular	O
set	O
of	O
local	O
channels	O
asynchronous	B-Architecture
and	O
synchronous	B-Architecture
,	O
forming	O
a	O
join	O
pattern	O
.	O
</s>
<s>
This	O
example	O
shows	O
all	O
new	O
keywords	O
used	O
by	O
Concurrent	B-Operating_System
Basic	O
:	O
Asynchronous	B-Architecture
,	O
Synchronous	B-Architecture
and	O
When	O
.	O
</s>
<s>
public	O
readonly	O
Asynchronous.Channelxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
Put	O
;	O
</s>
<s>
public	O
readonly	O
Synchronousxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1.Channel	O
Get	O
;	O
</s>
<s>
There	O
is	O
a	O
library	O
in	O
Scala	O
called	O
"	O
Scala	O
Joins	B-Library
"	O
Scala	O
Joins	B-Library
to	O
use	O
the	O
Join-Pattern	B-Operating_System
,	O
it	O
proposes	O
to	O
use	O
pattern	B-Language
matching	I-Language
Pattern	B-Language
Matching	I-Language
as	O
a	O
tool	O
for	O
creating	O
models	O
of	O
joins	B-Library
.	O
</s>
<s>
The	O
pattern	B-Language
matching	I-Language
facilities	O
of	O
this	O
language	O
have	O
been	O
generalized	O
to	O
allow	O
representation	O
independence	O
for	O
objects	O
used	O
in	O
pattern	B-Language
matching	I-Language
.	O
</s>
<s>
The	O
advantage	O
of	O
join	O
patterns	O
is	O
that	O
they	O
allow	O
a	O
declarative	O
specification	O
of	O
the	O
synchronization	O
between	O
different	O
threads	B-Operating_System
.	O
</s>
<s>
In	O
Scala	O
,	O
it	O
's	O
possible	O
to	O
solve	O
many	O
problem	O
with	O
the	O
pattern	B-Language
matching	I-Language
and	O
Scala	O
Joins	B-Library
,	O
for	O
example	O
the	O
Reader-Writer	O
.	O
</s>
<s>
So	O
,	O
it	O
's	O
possible	O
to	O
use	O
the	O
Join	O
construct	O
to	O
enable	O
a	O
pattern	B-Language
matching	I-Language
via	O
a	O
list	O
of	O
case	O
declarations	O
.	O
</s>
<s>
The	O
left-side	O
is	O
a	O
model	O
of	O
join	O
pattern	O
to	O
show	O
the	O
combinaison	O
of	O
events	O
asynchronous	B-Architecture
and	O
synchronous	B-Architecture
and	O
the	O
right-side	O
is	O
the	O
body	O
of	O
join	O
which	O
is	O
executed	O
with	O
the	O
join	O
model	O
is	O
completed	O
.	O
</s>
<s>
Actor-based	O
concurrency	B-Architecture
is	O
supported	O
by	O
means	O
of	O
a	O
library	O
and	O
we	O
provide	O
join	O
patterns	O
as	O
a	O
library	O
extension	O
as	O
well	O
,	O
so	O
there	O
are	O
the	O
opportunity	O
to	O
combine	O
join	O
patterns	O
with	O
the	O
event-driven	O
concurrency	B-Architecture
model	O
offered	O
by	O
actors	O
.	O
</s>
<s>
Scala	O
Join	O
and	O
Chymyst	O
are	O
newer	O
implementations	O
of	O
the	O
Join	O
Pattern	O
,	O
improving	O
upon	O
Dr.	O
Philipp	O
Haller	O
's	O
Scala	O
Joins	B-Library
.	O
</s>
<s>
Join	O
Language	O
is	O
an	O
implementation	O
of	O
the	O
Join	O
Pattern	O
in	O
Haskell	B-Language
.	O
</s>
<s>
So	O
an	O
example	O
of	O
this	O
innovation	O
has	O
been	O
implemented	O
in	O
Scheme	B-Language
.	O
</s>
<s>
So	O
in	O
Scheme	B-Language
,	O
the	O
part	O
before	O
/	O
is	O
propagated	O
and	O
the	O
part	O
after	O
/	O
is	O
removed	O
.	O
</s>
<s>
The	O
use	O
of	O
the	O
Goal-Based	O
is	O
to	O
divise	O
the	O
work	O
in	O
many	O
tasks	O
and	O
joins	B-Library
all	O
results	O
at	O
the	O
end	O
with	O
the	O
join	O
pattern	O
.	O
</s>
<s>
So	O
the	O
concurrent	B-Operating_System
join	O
pattern	O
application	O
executed	O
in	O
parallel	B-Operating_System
on	O
a	O
multi-core	O
architecture	O
does	O
n't	O
guarantee	O
that	O
parallel	B-Operating_System
execution	O
lead	O
to	O
conflicts	O
.	O
</s>
<s>
To	O
Guarantee	O
this	O
and	O
a	O
high	O
degree	O
of	O
parallelism	B-Operating_System
,	O
a	O
Software	B-Operating_System
Transactional	I-Operating_System
Memory	I-Operating_System
(	O
STM	O
)	O
within	O
a	O
highlytuned	O
concurrent	B-Operating_System
data	O
structure	O
based	O
on	O
atomic	O
compare-and-swap	B-Operating_System
(	O
CAS	O
)	O
is	O
use	O
.	O
</s>
<s>
This	O
allows	O
to	O
run	O
many	O
concurrents	B-Operating_System
operations	O
in	O
parallel	B-Operating_System
on	O
multi-core	O
architecture	O
.	O
</s>
<s>
Split	O
pattern	O
(	O
parallel	B-Operating_System
split''	O
)	O
:	O
perform	O
several	O
tasks	O
in	O
parallel	B-Operating_System
at	O
the	O
same	O
time	O
(	O
e.g.	O
</s>
<s>
Map	B-Operating_System
reduce	I-Operating_System
)	O
.	O
</s>
