SlideShare a Scribd company logo
1 of 60
Download to read offline
A Model for Concurrency
using 
Single-Writer Single-Assignment
Variables
CPA 2011, Limerick, Ireland	

Matthew Huntbach	

School of Electronic Engineering and Computer Science	

Queen Mary, University of London	

mmh@eecs.qmul.ac.uk
An Abstract Model for Computation 
with Agents acting Concurrently	

• The universe consists of Agents which have
shared access to Variables	

• Each variable must have exactly one agent which
can write to it (single writer)	

• Each variable may have any number of agents
which can read it (but see linearity later)	

• Once a variable has been written to, it cannot be
written to again (single assignment)
Reduction to Assignments	

• The simplest form of agent is an Assignment	

• An assignment represents a variable assigned to a tuple
containing a tag and further variables	

• An assignment counts as the writer of the variable it
assigns to	

• An application of a computation rule is an agent reducing
to a network of agents	

• An agent which consists only of assignments cannot
reduce further	

• When an agent reduces, every variable to which it is a
writer must have exactly one agent which is its new writer,
the new agent may be an assignment
Process	

• A Process is an agent which consists of a set of Rules	

• A Rule consists of a left-hand-side (lhs) which contains
Matches, and a right-hand-side (rhs) which is an agent (so
could be a network of agents)	

 A match consists of a variable which is matched, and a
Tuple it matches, consisting of a tag and any number of
new variables	

• A lhs may have 0 or 1 matches for each variable to which
the process has read access	

• A lhs may have 0 or 1 matches for each variable which is
in the tuple of another match in the lhs	

• A rhs must put every variable to which the process has
write access in a write position in its network
Reduction	

• A Reduction occurs when a tuple assigned to a variable to
which a process has read access has the same tag and same
number of variables as a match on the lhs of a rule	

• The variables in the tuple are linked to the variables in the
match, and the match is removed from the rule	

 If a rule has no matches, the process reduces to the
network of agents which is its rhs. The other rules are
discarded, and the rhs is incorporated directly into the
universe of agents	

• Assignments on the rhs to variables which the process had
write access may then match matches on the lhs of other
processes which have read access to those variables
Futures	

• A variable may be assigned a tuple which contains
variables which have not yet been assigned	

• Such a variable may then be used like any other
variable	

• The result is to build structures with “holes” which
are later written to	

• A process which needs to know the value of a
variable for a match to reduce cannot reduce until
it is assigned	

• This is like a “future” but requires no special
syntax
Linear Variables	

• Variables may be designated either linear or non-
linear	

• Linear variables must have exactly one reader as
well as exactly one writer	

• A linear variable may be assigned a tuple
containing non-linear and linear variables	

• A non-linear variable may only be assigned a tuple
containing non-linear variables
Back Communication	

• An assignment to a non-linear variable can only
have read access to variables in its tuple	

• An assignment to a linear variable may have write
access rather than read access to variables in its
tuple	

• On reduction, the reader of a linear variable which
is assigned a tuple which has write access to
further variables must put each of those variables
in exactly one write access position
Long-lived Agents	

• When an agent reduces to a network of agents, we
may consider one of them its successor	

• When a variable is assigned a tuple, we may
consider one of the variables in the tuple as its
successor	

• Agents may have rules in which one of the agents
in the network of agents on the rhs is a recursive
process	

• This enables us to model long-lived agents
communicating over channels,
Non-determinacy	

• The lhs of rules in a process need not be
mutually exclusive	

• This enables us to have non-determinate agents:
a situation may exist where more than one rule
may be applied	

• There is no backtracking to alternative once a
rule is selected	

• There is an indeterminate time delay between a
rule becoming applicable due to all matches
being matches, and the rule being applied, so we
cannot say that if another rule becomes
applicable, the first will still be used
The World	

• The world can be considered just another agent
within the agents network, which communicates
through an interface of shared variables.	

• So all situations can be considered in terms of a
closed network	

• The rhs of a rule can be considered a universe in
which the world is an additional agent whihjc
reads the variables the rhs has wrote access to and
writes to the variables the rhs has write access to	

• Any subset of a network of agents can have a
boundary drawn round it and the whole considered
“an agent”
A graphical representation	

• Agents can be written as nodes in a directed graph	

• A linear variable can be shown as an arc from one
agent (its writer) to another (its reader)	

• A non-linear variable with more than one readers
can be shown as an arc leading to a Duplicator,
with two arcs leading from the duplicator to other
agents or further duplicators	

• A non-linear variable with no readers can be
shown as an arc leading from an agent to an Eraser
A variable with 
one reader and one writer	

f(…)—(…,x,…), g(…,x,…)—…!
f! g!
x!
A linear variable with 
one reader and one writer	

f(…)—(…,X,…), g(…,X,…)—…!
f! g!
X!
A non-linear variable with 
two readers and one writer	

f(…)—x, g(…,x,…), h(…,x,…)!
f!
g!
x!
h!
Non-linear variable with two readers 
and one writer showing 
variable to variable assignment 	

f(…)—x, g(…,x,…), y—x, h
(…,y,…)!
f!
g!
x!
h!
y!
Assignment	

x=p(y,z)	

p!
x!
y!
z
!
A non-linear variable with 
two readers and one writer showing 
variable to variable assignment 	

f(…)—x, g(…,x,…), y—x, h(…,y,…)!
f!
g!
x!
h!
y!
Assignment with 
back communication	

X=q(y)—z!
q
y
!
z
X!
Three-way communication	

X=q(y)—z, g(…,X,…), !
f(…)—y, h(…,z,…)!
q
y
!
z
X!
f
!
g!
h
!
Communication through 
assignment extrusion and absorption 	

g!
A
B
!
C!
x
y
V!
r
!
f!
f(A,x,B,y)—V, g(y,V,C)—r!
g!
A
B
!
C!
x
y
V!
r
!
f!
f(A,x,B,y)—V ⇒
!f(A,x,B1,y)—V1, h(B,x,U)-B1, V=m
(V1)-U !
f
!
g!
h
m
A
B
!
C!
x
y
B1
!
V!
V1
!
U
!
r
!
f(A,x,B1,y)—V1, g(y,V,C)—r h
(B,x,U)-B1, V=m(V1)-U !
f
!
g!
h
m
A
B
!
C!
x
y
B1
!
V!
V1
!
U
!
r
!
g(y,V,C)—r @ V=m(V1)-U ⇒ g1(y,V1,C)—
(r,U) !
f
!
g!
h
m
A
B
!
C!
x
y
B1
!
V!
V1
!
U
!
r
!
f(A,x,B1,y)—V1, g1(y,V1,C)—
(r,U) h(B,x,U)—B1!
f
!
h
A
B
!
C!
x
y
B1
!
V1
!
U
!
r
!
g1!
g1(y,V1,C)—(r,U) ⇒
!g(y,V1,C1)—r, U=n(y,r)—s, k(s,C)—C1!
f
!
g!
h
A
B
!
C!
x
y
B1
!
V1
!
U
!
r
!
k
n s
!
C1
!
r
!
f
!
g!
h
A
B
!
C!
x
y
B1
!
V1
!
U
!
r
!
k
n s
!
C1
!
f(A,x,B1,y)—V1, g(y,V1,C1)—r h
(B,x,U)—B1, U=n(y,r)—s !
r
!
f
!
g!
h
A
B
!
C!
x
y
B1
!
V1
!
U
!
r
!
k
n
s
!
C1
!
f(A,x,B1,y)—V1, g(y,V1,C1)—r h
(B,x,U)—B1, U=n(y,r)—s !
r
!
h(B,x,U)—B1 @ U=n(y,r)—s ⇒
! !h1(B,x,y,r)—(B1,s)!
f
!
g!
A
B
!
C!
x
y
B1
!
V1
!
k
s
!
h1!
r
! C1
!
r
!
!A=p(A1)-a, B=q(d)-T, C=r(b,C2)
! !!
f
!
g!
A
B
!
C!
x
y
B1
!
V1
!
k
s
!
h1!
r
!
p
d!
T
A1
!
a
!
q
! r
!
C1
!
b C2
!
r
!
Nondeterminacy
! !
!
f
!
g!
A
B
!
C!
x
y
B1
!
V1
!
k
s
!
h1!
r
!
p
d!
T
A1
!
a
!
q
! r
!
C1
!
b C2
!
r
!
Nondeterminacy
! !
!
B
!
C!
x
y
p
d!
T
A1
!
a
!
q
!
r
!
b
C2
!
r
!
A
Rule with one match	

h(s,t)—r !
{!
… !
s=p(u,v) || f(v,t)—w, g(u,w)—r;!
…!
}	

s
t!
r
!
p
f
g
u
v
w
!
Successful match and rule reduction	

h(s,t)—r, s=p(x,y) ⇒!
!u—x, v—y, f(v,t)—w, g(u,w)—r!
s
t!
r
!
p
f
g
u
v w
!
p
x!
y
Assignment Absorption (1)	

h(s,t)—r, t=q(x,y)!
s
t!
r
!
p
f
g
u
v
w
!
q
x!
y
Assignment Absorption (1)	

h(s,t)—r, t=q(x,y) ⇒!
! h1(s,x,y)—r!
s
t!
r
!
p
f
g
u
v
w
!
q
x!
y
Rule with two independent matches	

s=p(u), t=q(v,w) || k(u,v,w)—r!
p!
q
k!
u
v!
w
s
t!
r!
Assignment absorption (2)	

t=q(x,y),!
h1(s,x,y)—r!
{ … s=p(u), t=q(v,w) || k(u,v,w)—r … }!
p!
q
k!
u
v!
w
s
t!
r!
x!
y
!
q
Assignment absorption (2)	

h(s,t)—r @ t=q(x,y) ⇒ h1(s,x,y)—r!
h2(s,x,y)—r!
{ … s=p(u) || v—x, w—y, k(u,v,w)—r … }!
p!
k!
u
w
s
r!
x!
y
!
v
!
Assignment absorption (3)	

• Rule eliminated from set if the tag or
number of variables or mode of variables
does not match
Rule with a match and 
a dependent match	

s=p(w,t), t=q(u,v) || f(w,u,v)—r!
u!
v
w!
s! r!
f
!
p
!
q
!
t
!
Rule with a left hand side duplicator 
and a dependent match	

s=p(w,t), t=q(u,v) || f(w,u,z)—x, g(v,t)—(z,y)!
u!
v
w!
s!
x!
f
!
p
!
q
!
t
! g
y
!
z!
Representing a mutable variable	

mutvar(S)—V!
{!
S=empty || V=empty;!
S=cons(M,S1), M=get(V1) ||!
merge(V1,V2)—V, mutvar(S1)—V2;!
S=cons(M,S1), M=set()—V1 ||!
V=empty, mutvar(S1)—V1!
}!
Syntactic Sugar	

mutvar(S)—V!
{!
S=[] || V=[];!
S=[get(V1)|S1] ||!
merge(V1,V2)—V, mutvar(S1)—V2;!
S=[set—V1|S1] ||!
V=[], mutvar(S1)—V1!
}!
More Syntactic Sugar	

mutvar(S)—V!
{!
S=[] || V=[];!
S.get(V1) |!
merge(V1,V)—V;!
S.set—V1 |!
V=[], V1—V!
}!
Representing a value	

value(n,S)!
{!
S=empty ||;!
S=cons(M,S1), M=get()—v ||!
!v—n, value(S1,n);!
}!
mutvar(S)—V, value(n,V) !
sets a new mutable variable to store the value n, it can
proceed without n being assigned.
[]
! []
!
[]
!
*
!
*!
:!
:
!
get!
set!
merge
!
S
!
S
!
S
V
!
V
!
V
mutvar(S)—V
!
[]
!
*
!
:!
S
!
S
n
get!
n!
value(n,S)!
Nondeterminate Stream Merger	

merge(S1,S2)-S!
{!
S1=empty || S-S2;!
S2=empty || S-S1;!
S1=cons(M,S1t) || !
! S=cons(M,St), merge(S1t,S2)-St;!
S2=cons(M,S2t) || !
! S=cons(M,St), merge(S1,S2t)-St;!
}!
merge(S1,S2)—S!
[]
!
S1
!
S2
!
S1
!
S2
! []
!
:
!
S1
!
S2
!
S1
!
S2
! :
!
:
!
*
!
*
!
:
!
S
!
S
!
S
!
S
!
append(S1,S2)—S!
[]
!
S1
!
S2
!
:
!
S1
!
S2
!
:
!
*
!
S
!
S
!
Representing a lockable variable	

lockvar(S)—V!
{!
S=empty || V=empty;!
S=cons(M,S1), M=get(V1) ||!
merge(V1,V2)—V, lockvar(S1)—V2;!
S=cons(M,S1), M=set()—V1 ||!
V=empty, lockvar(S1)—V1;!
S=cons(M,S1), M=lock(S2) ||	

! append(S2,S1)—S3, lockvar(S3)—V;!
}!
Representing an Asynchronous Channel	

achan(Ch)-(Puts,Gets)!
{!
Ch=[] || Puts=[], Gets=[];!
Ch=[P|Ch1], P=()-V || !
! P1=()-V, Puts=[P1|Puts1], achan(Ch1)—(Puts1,Gets);!
Ch=[G|Ch1], G=(V) || !
! G1=(V), Gets=[G1|Gets1], achan(Ch)—(Puts,Gets1);!
}!
achan1(Puts,Gets)!
{!
Puts=[P|Puts1], P=()—V1, Gets=[G|Gets1], G=(V2) ||!
!V1—V2, achan1(Puts1,Gets1);!
}!
Using a mutable variable or
asynchronous channel	

S=[()—V|S1] !
S=[(V)|S1]!
use S1 for variable/channel subsequently	

append(S1,S2)—S	

use S1 and S2 for variable/channel (sequential access)	

merge(S1,S2)—S	

use S1 and S2 for variable/channel (concurrent access)
Representing a λ-expression	

	

With exp(E)-(X,V) where E represents the
expression, X is the argument and V represents a free
variable, λx.exp is represented by F where	

!lambda(F)—V!
!{!
! F=[] || V=[];!
! F=[C|F1], C=(R)—X || exp(R)—(X,V1), !!
! !lambda(F1)—V2, merge(V1,V2)—V!
!}!
	

then (λx.exp) n is given by R in F=[(R)—N|F1] where
N represents n, with F1 used for λx.exp subsequently.
Y Combinator	

	

If F represents a λ-expression f, then the
expression Y f can be represented by R with: 	

!F=[(R1)-F1], merge(F1,R)-R1	

:
!
F
R
merge
!
[
]!
History: “Aldwych Core”	

• “Aldwych” general purpose concurrent language,
originally syntactic sugar for concurrent logic
programming	

• Identification of minimal subset of concurrent
logic language needed for Aldwych	

• Establishment of variable moding and linearity
throughout	

• Improved operational model making use of
knowledge of modes and linearity
Current work	

• Aldwych syntactic sugar incorporated features of
major programming language paradigms	

• Aldwych enabled a fine control of concurrent
variations of language features	

• So Aldwych Core can be used as an abstract
model of concurrency giving an operational
semantics	

• Aldwych computes naturally with “holes”:
variables not currently assigned, as they are being
written to concurrently
Future work	

• Computing with “holes” is a form of proof:
finding properties of programs before data is
supplied	

• Further use of partial evaluation techniques
provides deeper proofs	

• Aldwych computation is naturally in terms of an
agent interacting with “the world” 	

• This has similarities with the “game semantics”
insight	

• Can partial evaluation of Aldwych be taken to the
point of providing full denotational semantics?

More Related Content

Similar to A Model For Concurrency Using Single-Writer Single-Assignment Variables

Unit 1 polynomial manipulation
Unit 1   polynomial manipulationUnit 1   polynomial manipulation
Unit 1 polynomial manipulationLavanyaJ28
 
Markov Chain & Matrix Geometric Analysis.pptx
Markov Chain & Matrix Geometric Analysis.pptxMarkov Chain & Matrix Geometric Analysis.pptx
Markov Chain & Matrix Geometric Analysis.pptxHabibullahAbbasi2
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxMr. Moms
 
Basic Behavioral Modeling
Basic Behavioral ModelingBasic Behavioral Modeling
Basic Behavioral ModelingAMITJain879
 
Impromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and otherImpromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and otherHarshit Srivastava
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagramsbabak danyal
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logicAdPatel5
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operatorsteach4uin
 
Least Cost Influence in Multiplex Social Networks
Least Cost Influence in Multiplex Social NetworksLeast Cost Influence in Multiplex Social Networks
Least Cost Influence in Multiplex Social NetworksNatasha Mandal
 
Data weave (MuleSoft)
Data weave (MuleSoft)Data weave (MuleSoft)
Data weave (MuleSoft)Nandu List5
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Iffat Anjum
 
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbw
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbwUseCaseDiagrams.pdf shhsja whuwbwnwhwywbw
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbw211b410
 

Similar to A Model For Concurrency Using Single-Writer Single-Assignment Variables (20)

Unit 1 polynomial manipulation
Unit 1   polynomial manipulationUnit 1   polynomial manipulation
Unit 1 polynomial manipulation
 
Markov Chain & Matrix Geometric Analysis.pptx
Markov Chain & Matrix Geometric Analysis.pptxMarkov Chain & Matrix Geometric Analysis.pptx
Markov Chain & Matrix Geometric Analysis.pptx
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docx
 
Reader Writer problem
Reader Writer problemReader Writer problem
Reader Writer problem
 
Basic Behavioral Modeling
Basic Behavioral ModelingBasic Behavioral Modeling
Basic Behavioral Modeling
 
Impromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and otherImpromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and other
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagrams
 
Linear Regression.pptx
Linear Regression.pptxLinear Regression.pptx
Linear Regression.pptx
 
CH6,7.pptx
CH6,7.pptxCH6,7.pptx
CH6,7.pptx
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
Least Cost Influence in Multiplex Social Networks
Least Cost Influence in Multiplex Social NetworksLeast Cost Influence in Multiplex Social Networks
Least Cost Influence in Multiplex Social Networks
 
Data weave (MuleSoft)
Data weave (MuleSoft)Data weave (MuleSoft)
Data weave (MuleSoft)
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2
 
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbw
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbwUseCaseDiagrams.pdf shhsja whuwbwnwhwywbw
UseCaseDiagrams.pdf shhsja whuwbwnwhwywbw
 
linear regression .pptx
linear regression .pptxlinear regression .pptx
linear regression .pptx
 

More from Sheila Sinclair

Visual Medium Advertisement Analysis Es. Online assignment writing service.
Visual Medium Advertisement Analysis Es. Online assignment writing service.Visual Medium Advertisement Analysis Es. Online assignment writing service.
Visual Medium Advertisement Analysis Es. Online assignment writing service.Sheila Sinclair
 
Personal Essay Template. The Per. Online assignment writing service.
Personal Essay Template. The Per. Online assignment writing service.Personal Essay Template. The Per. Online assignment writing service.
Personal Essay Template. The Per. Online assignment writing service.Sheila Sinclair
 
Steps On How To Write An Essay. Steps To Writing An
Steps On How To Write An Essay. Steps To Writing AnSteps On How To Write An Essay. Steps To Writing An
Steps On How To Write An Essay. Steps To Writing AnSheila Sinclair
 
Free Writing Paper Cliparts, Download Free Writing Pa
Free Writing Paper Cliparts, Download Free Writing PaFree Writing Paper Cliparts, Download Free Writing Pa
Free Writing Paper Cliparts, Download Free Writing PaSheila Sinclair
 
Descriptive Paragraph On Nature. Essay On Nature. 2
Descriptive Paragraph On Nature. Essay On Nature. 2Descriptive Paragraph On Nature. Essay On Nature. 2
Descriptive Paragraph On Nature. Essay On Nature. 2Sheila Sinclair
 
.Mickey And Minnie Stationary Writing Paper
.Mickey And Minnie Stationary Writing Paper.Mickey And Minnie Stationary Writing Paper
.Mickey And Minnie Stationary Writing PaperSheila Sinclair
 
Sample Seminar Report. Online assignment writing service.
Sample Seminar Report. Online assignment writing service.Sample Seminar Report. Online assignment writing service.
Sample Seminar Report. Online assignment writing service.Sheila Sinclair
 
Writing A Speech For Your Presentation - Soalanrule
Writing A Speech For Your Presentation - SoalanruleWriting A Speech For Your Presentation - Soalanrule
Writing A Speech For Your Presentation - SoalanruleSheila Sinclair
 
Synthesis Journal Example. Synthesis Exa
Synthesis Journal Example. Synthesis ExaSynthesis Journal Example. Synthesis Exa
Synthesis Journal Example. Synthesis ExaSheila Sinclair
 
Self-Introduction Essay - 6 Examples, Form
Self-Introduction Essay - 6 Examples, FormSelf-Introduction Essay - 6 Examples, Form
Self-Introduction Essay - 6 Examples, FormSheila Sinclair
 
Owl Writing Paper Teaching Resources. Online assignment writing service.
Owl Writing Paper Teaching Resources. Online assignment writing service.Owl Writing Paper Teaching Resources. Online assignment writing service.
Owl Writing Paper Teaching Resources. Online assignment writing service.Sheila Sinclair
 
Admission Essay Outline Of A Descriptive Essay
Admission Essay Outline Of A Descriptive EssayAdmission Essay Outline Of A Descriptive Essay
Admission Essay Outline Of A Descriptive EssaySheila Sinclair
 
Essay Size - Dimension, Inches, Mm, Cms, Pixel
Essay Size - Dimension, Inches, Mm, Cms, PixelEssay Size - Dimension, Inches, Mm, Cms, Pixel
Essay Size - Dimension, Inches, Mm, Cms, PixelSheila Sinclair
 
How To Write An Introduction Paragraph For An Essay About A Boo
How To Write An Introduction Paragraph For An Essay About A BooHow To Write An Introduction Paragraph For An Essay About A Boo
How To Write An Introduction Paragraph For An Essay About A BooSheila Sinclair
 
008 Self Introduction Essay Sample Help G
008 Self Introduction Essay Sample Help G008 Self Introduction Essay Sample Help G
008 Self Introduction Essay Sample Help GSheila Sinclair
 
30 High School Scholarship Essay Examples Exampl
30 High School Scholarship Essay Examples Exampl30 High School Scholarship Essay Examples Exampl
30 High School Scholarship Essay Examples ExamplSheila Sinclair
 
How To Write Explanation Paper Allsop Author
How To Write Explanation Paper Allsop AuthorHow To Write Explanation Paper Allsop Author
How To Write Explanation Paper Allsop AuthorSheila Sinclair
 
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple PagesSheila Sinclair
 
Top 10 Best Term Paper Writing Services, Professional Paper Writing
Top 10 Best Term Paper Writing Services, Professional Paper WritingTop 10 Best Term Paper Writing Services, Professional Paper Writing
Top 10 Best Term Paper Writing Services, Professional Paper WritingSheila Sinclair
 
College Essay Persuasive Essay Conclusion Format
College Essay Persuasive Essay Conclusion FormatCollege Essay Persuasive Essay Conclusion Format
College Essay Persuasive Essay Conclusion FormatSheila Sinclair
 

More from Sheila Sinclair (20)

Visual Medium Advertisement Analysis Es. Online assignment writing service.
Visual Medium Advertisement Analysis Es. Online assignment writing service.Visual Medium Advertisement Analysis Es. Online assignment writing service.
Visual Medium Advertisement Analysis Es. Online assignment writing service.
 
Personal Essay Template. The Per. Online assignment writing service.
Personal Essay Template. The Per. Online assignment writing service.Personal Essay Template. The Per. Online assignment writing service.
Personal Essay Template. The Per. Online assignment writing service.
 
Steps On How To Write An Essay. Steps To Writing An
Steps On How To Write An Essay. Steps To Writing AnSteps On How To Write An Essay. Steps To Writing An
Steps On How To Write An Essay. Steps To Writing An
 
Free Writing Paper Cliparts, Download Free Writing Pa
Free Writing Paper Cliparts, Download Free Writing PaFree Writing Paper Cliparts, Download Free Writing Pa
Free Writing Paper Cliparts, Download Free Writing Pa
 
Descriptive Paragraph On Nature. Essay On Nature. 2
Descriptive Paragraph On Nature. Essay On Nature. 2Descriptive Paragraph On Nature. Essay On Nature. 2
Descriptive Paragraph On Nature. Essay On Nature. 2
 
.Mickey And Minnie Stationary Writing Paper
.Mickey And Minnie Stationary Writing Paper.Mickey And Minnie Stationary Writing Paper
.Mickey And Minnie Stationary Writing Paper
 
Sample Seminar Report. Online assignment writing service.
Sample Seminar Report. Online assignment writing service.Sample Seminar Report. Online assignment writing service.
Sample Seminar Report. Online assignment writing service.
 
Writing A Speech For Your Presentation - Soalanrule
Writing A Speech For Your Presentation - SoalanruleWriting A Speech For Your Presentation - Soalanrule
Writing A Speech For Your Presentation - Soalanrule
 
Synthesis Journal Example. Synthesis Exa
Synthesis Journal Example. Synthesis ExaSynthesis Journal Example. Synthesis Exa
Synthesis Journal Example. Synthesis Exa
 
Self-Introduction Essay - 6 Examples, Form
Self-Introduction Essay - 6 Examples, FormSelf-Introduction Essay - 6 Examples, Form
Self-Introduction Essay - 6 Examples, Form
 
Owl Writing Paper Teaching Resources. Online assignment writing service.
Owl Writing Paper Teaching Resources. Online assignment writing service.Owl Writing Paper Teaching Resources. Online assignment writing service.
Owl Writing Paper Teaching Resources. Online assignment writing service.
 
Admission Essay Outline Of A Descriptive Essay
Admission Essay Outline Of A Descriptive EssayAdmission Essay Outline Of A Descriptive Essay
Admission Essay Outline Of A Descriptive Essay
 
Essay Size - Dimension, Inches, Mm, Cms, Pixel
Essay Size - Dimension, Inches, Mm, Cms, PixelEssay Size - Dimension, Inches, Mm, Cms, Pixel
Essay Size - Dimension, Inches, Mm, Cms, Pixel
 
How To Write An Introduction Paragraph For An Essay About A Boo
How To Write An Introduction Paragraph For An Essay About A BooHow To Write An Introduction Paragraph For An Essay About A Boo
How To Write An Introduction Paragraph For An Essay About A Boo
 
008 Self Introduction Essay Sample Help G
008 Self Introduction Essay Sample Help G008 Self Introduction Essay Sample Help G
008 Self Introduction Essay Sample Help G
 
30 High School Scholarship Essay Examples Exampl
30 High School Scholarship Essay Examples Exampl30 High School Scholarship Essay Examples Exampl
30 High School Scholarship Essay Examples Exampl
 
How To Write Explanation Paper Allsop Author
How To Write Explanation Paper Allsop AuthorHow To Write Explanation Paper Allsop Author
How To Write Explanation Paper Allsop Author
 
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages
14 Financial Analysis Templates - AI, PSD, Google Docs, Apple Pages
 
Top 10 Best Term Paper Writing Services, Professional Paper Writing
Top 10 Best Term Paper Writing Services, Professional Paper WritingTop 10 Best Term Paper Writing Services, Professional Paper Writing
Top 10 Best Term Paper Writing Services, Professional Paper Writing
 
College Essay Persuasive Essay Conclusion Format
College Essay Persuasive Essay Conclusion FormatCollege Essay Persuasive Essay Conclusion Format
College Essay Persuasive Essay Conclusion Format
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

A Model For Concurrency Using Single-Writer Single-Assignment Variables

  • 1. A Model for Concurrency using Single-Writer Single-Assignment Variables CPA 2011, Limerick, Ireland Matthew Huntbach School of Electronic Engineering and Computer Science Queen Mary, University of London mmh@eecs.qmul.ac.uk
  • 2. An Abstract Model for Computation with Agents acting Concurrently • The universe consists of Agents which have shared access to Variables • Each variable must have exactly one agent which can write to it (single writer) • Each variable may have any number of agents which can read it (but see linearity later) • Once a variable has been written to, it cannot be written to again (single assignment)
  • 3. Reduction to Assignments • The simplest form of agent is an Assignment • An assignment represents a variable assigned to a tuple containing a tag and further variables • An assignment counts as the writer of the variable it assigns to • An application of a computation rule is an agent reducing to a network of agents • An agent which consists only of assignments cannot reduce further • When an agent reduces, every variable to which it is a writer must have exactly one agent which is its new writer, the new agent may be an assignment
  • 4. Process • A Process is an agent which consists of a set of Rules • A Rule consists of a left-hand-side (lhs) which contains Matches, and a right-hand-side (rhs) which is an agent (so could be a network of agents)  A match consists of a variable which is matched, and a Tuple it matches, consisting of a tag and any number of new variables • A lhs may have 0 or 1 matches for each variable to which the process has read access • A lhs may have 0 or 1 matches for each variable which is in the tuple of another match in the lhs • A rhs must put every variable to which the process has write access in a write position in its network
  • 5. Reduction • A Reduction occurs when a tuple assigned to a variable to which a process has read access has the same tag and same number of variables as a match on the lhs of a rule • The variables in the tuple are linked to the variables in the match, and the match is removed from the rule  If a rule has no matches, the process reduces to the network of agents which is its rhs. The other rules are discarded, and the rhs is incorporated directly into the universe of agents • Assignments on the rhs to variables which the process had write access may then match matches on the lhs of other processes which have read access to those variables
  • 6. Futures • A variable may be assigned a tuple which contains variables which have not yet been assigned • Such a variable may then be used like any other variable • The result is to build structures with “holes” which are later written to • A process which needs to know the value of a variable for a match to reduce cannot reduce until it is assigned • This is like a “future” but requires no special syntax
  • 7. Linear Variables • Variables may be designated either linear or non- linear • Linear variables must have exactly one reader as well as exactly one writer • A linear variable may be assigned a tuple containing non-linear and linear variables • A non-linear variable may only be assigned a tuple containing non-linear variables
  • 8. Back Communication • An assignment to a non-linear variable can only have read access to variables in its tuple • An assignment to a linear variable may have write access rather than read access to variables in its tuple • On reduction, the reader of a linear variable which is assigned a tuple which has write access to further variables must put each of those variables in exactly one write access position
  • 9. Long-lived Agents • When an agent reduces to a network of agents, we may consider one of them its successor • When a variable is assigned a tuple, we may consider one of the variables in the tuple as its successor • Agents may have rules in which one of the agents in the network of agents on the rhs is a recursive process • This enables us to model long-lived agents communicating over channels,
  • 10. Non-determinacy • The lhs of rules in a process need not be mutually exclusive • This enables us to have non-determinate agents: a situation may exist where more than one rule may be applied • There is no backtracking to alternative once a rule is selected • There is an indeterminate time delay between a rule becoming applicable due to all matches being matches, and the rule being applied, so we cannot say that if another rule becomes applicable, the first will still be used
  • 11. The World • The world can be considered just another agent within the agents network, which communicates through an interface of shared variables. • So all situations can be considered in terms of a closed network • The rhs of a rule can be considered a universe in which the world is an additional agent whihjc reads the variables the rhs has wrote access to and writes to the variables the rhs has write access to • Any subset of a network of agents can have a boundary drawn round it and the whole considered “an agent”
  • 12. A graphical representation • Agents can be written as nodes in a directed graph • A linear variable can be shown as an arc from one agent (its writer) to another (its reader) • A non-linear variable with more than one readers can be shown as an arc leading to a Duplicator, with two arcs leading from the duplicator to other agents or further duplicators • A non-linear variable with no readers can be shown as an arc leading from an agent to an Eraser
  • 13. A variable with one reader and one writer f(…)—(…,x,…), g(…,x,…)—…! f! g! x!
  • 14. A linear variable with one reader and one writer f(…)—(…,X,…), g(…,X,…)—…! f! g! X!
  • 15. A non-linear variable with two readers and one writer f(…)—x, g(…,x,…), h(…,x,…)! f! g! x! h!
  • 16. Non-linear variable with two readers and one writer showing variable to variable assignment f(…)—x, g(…,x,…), y—x, h (…,y,…)! f! g! x! h! y!
  • 18. A non-linear variable with two readers and one writer showing variable to variable assignment f(…)—x, g(…,x,…), y—x, h(…,y,…)! f! g! x! h! y!
  • 19. Assignment with back communication X=q(y)—z! q y ! z X!
  • 20. Three-way communication X=q(y)—z, g(…,X,…), ! f(…)—y, h(…,z,…)! q y ! z X! f ! g! h !
  • 21. Communication through assignment extrusion and absorption g! A B ! C! x y V! r ! f!
  • 23. f(A,x,B,y)—V ⇒ !f(A,x,B1,y)—V1, h(B,x,U)-B1, V=m (V1)-U ! f ! g! h m A B ! C! x y B1 ! V! V1 ! U ! r !
  • 24. f(A,x,B1,y)—V1, g(y,V,C)—r h (B,x,U)-B1, V=m(V1)-U ! f ! g! h m A B ! C! x y B1 ! V! V1 ! U ! r !
  • 25. g(y,V,C)—r @ V=m(V1)-U ⇒ g1(y,V1,C)— (r,U) ! f ! g! h m A B ! C! x y B1 ! V! V1 ! U ! r !
  • 27. g1(y,V1,C)—(r,U) ⇒ !g(y,V1,C1)—r, U=n(y,r)—s, k(s,C)—C1! f ! g! h A B ! C! x y B1 ! V1 ! U ! r ! k n s ! C1 ! r !
  • 30. h(B,x,U)—B1 @ U=n(y,r)—s ⇒ ! !h1(B,x,y,r)—(B1,s)! f ! g! A B ! C! x y B1 ! V1 ! k s ! h1! r ! C1 ! r !
  • 31. !A=p(A1)-a, B=q(d)-T, C=r(b,C2) ! !! f ! g! A B ! C! x y B1 ! V1 ! k s ! h1! r ! p d! T A1 ! a ! q ! r ! C1 ! b C2 ! r !
  • 34. Rule with one match h(s,t)—r ! {! … ! s=p(u,v) || f(v,t)—w, g(u,w)—r;! …! } s t! r ! p f g u v w !
  • 35. Successful match and rule reduction h(s,t)—r, s=p(x,y) ⇒! !u—x, v—y, f(v,t)—w, g(u,w)—r! s t! r ! p f g u v w ! p x! y
  • 36. Assignment Absorption (1) h(s,t)—r, t=q(x,y)! s t! r ! p f g u v w ! q x! y
  • 37. Assignment Absorption (1) h(s,t)—r, t=q(x,y) ⇒! ! h1(s,x,y)—r! s t! r ! p f g u v w ! q x! y
  • 38. Rule with two independent matches s=p(u), t=q(v,w) || k(u,v,w)—r! p! q k! u v! w s t! r!
  • 39. Assignment absorption (2) t=q(x,y),! h1(s,x,y)—r! { … s=p(u), t=q(v,w) || k(u,v,w)—r … }! p! q k! u v! w s t! r! x! y ! q
  • 40. Assignment absorption (2) h(s,t)—r @ t=q(x,y) ⇒ h1(s,x,y)—r! h2(s,x,y)—r! { … s=p(u) || v—x, w—y, k(u,v,w)—r … }! p! k! u w s r! x! y ! v !
  • 41. Assignment absorption (3) • Rule eliminated from set if the tag or number of variables or mode of variables does not match
  • 42. Rule with a match and a dependent match s=p(w,t), t=q(u,v) || f(w,u,v)—r! u! v w! s! r! f ! p ! q ! t !
  • 43. Rule with a left hand side duplicator and a dependent match s=p(w,t), t=q(u,v) || f(w,u,z)—x, g(v,t)—(z,y)! u! v w! s! x! f ! p ! q ! t ! g y ! z!
  • 44. Representing a mutable variable mutvar(S)—V! {! S=empty || V=empty;! S=cons(M,S1), M=get(V1) ||! merge(V1,V2)—V, mutvar(S1)—V2;! S=cons(M,S1), M=set()—V1 ||! V=empty, mutvar(S1)—V1! }!
  • 45. Syntactic Sugar mutvar(S)—V! {! S=[] || V=[];! S=[get(V1)|S1] ||! merge(V1,V2)—V, mutvar(S1)—V2;! S=[set—V1|S1] ||! V=[], mutvar(S1)—V1! }!
  • 46. More Syntactic Sugar mutvar(S)—V! {! S=[] || V=[];! S.get(V1) |! merge(V1,V)—V;! S.set—V1 |! V=[], V1—V! }!
  • 47. Representing a value value(n,S)! {! S=empty ||;! S=cons(M,S1), M=get()—v ||! !v—n, value(S1,n);! }! mutvar(S)—V, value(n,V) ! sets a new mutable variable to store the value n, it can proceed without n being assigned.
  • 50. Nondeterminate Stream Merger merge(S1,S2)-S! {! S1=empty || S-S2;! S2=empty || S-S1;! S1=cons(M,S1t) || ! ! S=cons(M,St), merge(S1t,S2)-St;! S2=cons(M,S2t) || ! ! S=cons(M,St), merge(S1,S2t)-St;! }!
  • 53. Representing a lockable variable lockvar(S)—V! {! S=empty || V=empty;! S=cons(M,S1), M=get(V1) ||! merge(V1,V2)—V, lockvar(S1)—V2;! S=cons(M,S1), M=set()—V1 ||! V=empty, lockvar(S1)—V1;! S=cons(M,S1), M=lock(S2) || ! append(S2,S1)—S3, lockvar(S3)—V;! }!
  • 54. Representing an Asynchronous Channel achan(Ch)-(Puts,Gets)! {! Ch=[] || Puts=[], Gets=[];! Ch=[P|Ch1], P=()-V || ! ! P1=()-V, Puts=[P1|Puts1], achan(Ch1)—(Puts1,Gets);! Ch=[G|Ch1], G=(V) || ! ! G1=(V), Gets=[G1|Gets1], achan(Ch)—(Puts,Gets1);! }! achan1(Puts,Gets)! {! Puts=[P|Puts1], P=()—V1, Gets=[G|Gets1], G=(V2) ||! !V1—V2, achan1(Puts1,Gets1);! }!
  • 55. Using a mutable variable or asynchronous channel S=[()—V|S1] ! S=[(V)|S1]! use S1 for variable/channel subsequently append(S1,S2)—S use S1 and S2 for variable/channel (sequential access) merge(S1,S2)—S use S1 and S2 for variable/channel (concurrent access)
  • 56. Representing a λ-expression With exp(E)-(X,V) where E represents the expression, X is the argument and V represents a free variable, λx.exp is represented by F where !lambda(F)—V! !{! ! F=[] || V=[];! ! F=[C|F1], C=(R)—X || exp(R)—(X,V1), !! ! !lambda(F1)—V2, merge(V1,V2)—V! !}! then (λx.exp) n is given by R in F=[(R)—N|F1] where N represents n, with F1 used for λx.exp subsequently.
  • 57. Y Combinator If F represents a λ-expression f, then the expression Y f can be represented by R with: !F=[(R1)-F1], merge(F1,R)-R1 : ! F R merge ! [ ]!
  • 58. History: “Aldwych Core” • “Aldwych” general purpose concurrent language, originally syntactic sugar for concurrent logic programming • Identification of minimal subset of concurrent logic language needed for Aldwych • Establishment of variable moding and linearity throughout • Improved operational model making use of knowledge of modes and linearity
  • 59. Current work • Aldwych syntactic sugar incorporated features of major programming language paradigms • Aldwych enabled a fine control of concurrent variations of language features • So Aldwych Core can be used as an abstract model of concurrency giving an operational semantics • Aldwych computes naturally with “holes”: variables not currently assigned, as they are being written to concurrently
  • 60. Future work • Computing with “holes” is a form of proof: finding properties of programs before data is supplied • Further use of partial evaluation techniques provides deeper proofs • Aldwych computation is naturally in terms of an agent interacting with “the world” • This has similarities with the “game semantics” insight • Can partial evaluation of Aldwych be taken to the point of providing full denotational semantics?