@@ -15,13 +15,18 @@
15\newcommand{\sThrow}{\mathtt{throw}}
15\newcommand{\sThrow}{\mathtt{throw}}
16\newcommand{\sReconnect}{\mathtt{reconnect}}
16\newcommand{\sReconnect}{\mathtt{reconnect}}
18+\newcommand{\sSpawned}{\mathtt{spawned}}
20+\newcommand{\sExtend}[1]{\mathrel{\triangleright_{#1}}}
18−\newcommand{\sPar}{\mathrel{{\parallel}_P}}
22+\newcommand{\sPar}{\mathrel{\parallel}}
19\newcommand{\sParN}{\mathrel{{\parallel}_N}}
23\newcommand{\sParN}{\mathrel{{\parallel}_N}}
20\newcommand{\sProc}[2]{{#1}_{#2}}
24\newcommand{\sProc}[2]{{#1}_{#2}}
22\newcommand{\sPid}{\ensuremath{\mathit{pid}}}
26\newcommand{\sPid}{\ensuremath{\mathit{pid}}}
23\newcommand{\sNid}{\ensuremath{\mathit{nid}}}
27\newcommand{\sNid}{\ensuremath{\mathit{nid}}}
24\newcommand{\sId}{\ensuremath{\mathit{id}}}
28\newcommand{\sId}{\ensuremath{\mathit{id}}}
29+\newcommand{\sRef}{\ensuremath{\mathit{ref}}}
26\newcommand{\sLinks}{\ensuremath{\mathit{links}}}
31\newcommand{\sLinks}{\ensuremath{\mathit{links}}}
27\newcommand{\sNode}[3]{\left[{#1} ; {#2}\right]_{#3}}
32\newcommand{\sNode}[3]{\left[{#1} ; {#2}\right]_{#3}}
@@ -101,33 +106,12 @@ We define an evaluation context as usual (TODO: catch?)
101\sCtxt{E} ::= [] \OR \sBind{\sCtxt{E}}{M}
106\sCtxt{E} ::= [] \OR \sBind{\sCtxt{E}}{M}
102\end{equation*}
107\end{equation*}
104−A process context, parametrized by a \sPid, identifies a process within a set
108−\sCtxt{P}_\sPid ::= \sNode{\sProc{\sCtxt{E}}{pid} \sPar \sProcesses}{\sLinks}{\sNid} \sParN \sNodes
111−We also find it useful to have a process context with two holes, one for a
112−process identified by \sPid{} and one for the set of processes on node \sNid.
113−This set of processes may or may not live on the same node as \sPid.
117−\sCtxt{P}_{\sPid,\sNid} ::= &
118− \sNode{\sProc{\sCtxt{E}}{pid} \sPar []}{\sLinks}{\sNid} \sParN \sNodes \\[1em]
120− \sNode{\sProc{\sCtxt{E}}{pid} \sPar \sProcesses}{\sLinks}{\sNid'} \sParN \sNode{[]}{\sLinks}{\sNid} \sParN \sNodes
126−\subsection{System Rules}
109+\subsection{Disconnect}
128At the Cloud Haskell level we assume that \emph{nodes} get disconnected, not
111At the Cloud Haskell level we assume that \emph{nodes} get disconnected, not
112+individual processes. \emph{Reconnecting} however is on a per process basis. To
129−individual processes. To formalize this, let $\overline{\sNid}$ be the smallest
113+formalize this, let $\overline{\sNid}$ be the smallest set, given a set of
130−set, given a set of processes $\sProcesses$, such that
114+processes $\sProcesses$, such that
132\begin{equation*}
116\begin{equation*}
@@ -175,6 +159,26 @@ However, connections to and from nodes can be implicitly reconnected:
175} \textsc{Recon-Fr}
159} \textsc{Recon-Fr}
176\end{equation*}
160\end{equation*}
162+Once a connection has been blacklisted, no further messages can be sent across
163+that connection (until an explicit or implicit reconnect). To model this we
167+\begin{array}{l@{\;=\;}l@{\hspace{3em}}l}
168+ \sQueue \sExtend{\sBlacklist} (\sId_\mathit{to}, \sId_\mathit{fr}, M)
170+ \sQueue, (\sId_\mathit{to}, \sId_\mathit{fr}, M)
172+ \text{if } (\sId_\mathit{to}, \sId_\mathit{fr}) \notin \sBlacklist
174+ \sQueue \sExtend{\sBlacklist} (\sId_\mathit{to}, \sId_\mathit{fr}, M)
178\subsection{Process rules}
182\subsection{Process rules}
180\subsubsection{Sending}
184\subsubsection{Sending}
@@ -183,33 +187,21 @@ If the communication is blacklisted the send is a no-op.
184\begin{equation*}
188\begin{equation*}
186−(\mathit{to}, \mathit{fr}) \notin \sBlacklist
188− \sSystem{\sCtxt{P}[ \sSend \; \mathit{to} \; V ]_\mathit{fr}}
191+ \sSystem{ \sCtxt{E}[ \sSend \; \sPid_\mathit{to} \; M ]_{\sPid_\mathit{fr}}
189 {\sQueue}
195 {\sQueue}
190 {\sBlacklist}
196 {\sBlacklist}
191\rightarrow
197\rightarrow
192− \sSystem{\sCtxt{P}[ \sReturn \; () ]_\mathit{fr}}
198+ \sSystem{\sCtxt{E}[ \sReturn \; () ]_\mathit{fr} \sPar \sProcesses}
193− {\sQueue, (\mathit{to}, \mathit{fr}, V)}
199+ {\sQueue \sExtend{\sBlacklist} (\sPid_\mathit{to}, \sPid_\mathit{fr}, M)}
194 {\sBlacklist}
200 {\sBlacklist}
195−} \textsc{Send-Ok}
201+} \textsc{Send}
196\end{equation*}
202\end{equation*}
198−\begin{equation*}
204+We ignore issues of serializability for the purposes of this semantics.
200−(\mathit{to}, \mathit{fr}) \in \sBlacklist
202− \sSystem{\sCtxt{P}[ \sSend \; \mathit{to} \; V ]_\mathit{fr}}
206− \sSystem{\sCtxt{P}[ \sReturn \; () ]_\mathit{fr}}
212−TODO: this allows to send functions
214\subsubsection{Receiving}
206\subsubsection{Receiving}
@@ -217,13 +209,13 @@ We return the \emph{first} message of a randomly chosen sender.
218\begin{equation*}
210\begin{equation*}
220− \mathit{fr} \notin \sSenders(\sQueue)
212+ \sId_{\mathit{fr}} \notin \sSenders(\sQueue)
222− \sSystem{\sCtxt{P}[ \sExpect ]_\mathit{fr}}
214+ \sSystem{\sCtxt{E}[ \sExpect ]_{\sPid_\mathit{to}} \sPar \sProcesses}
223− {\sQueue, (\mathit{to}, \mathit{fr}, V), \sQueue'}
215+ {\sQueue, (\sPid_\mathit{to}, \sId_\mathit{fr}, M), \sQueue'}
224 {\sBlacklist}
216 {\sBlacklist}
225\rightarrow
217\rightarrow
226− \sSystem{\sCtxt{P}[ \sReturn \; V ]_\mathit{fr}}
218+ \sSystem{\sCtxt{E}[ \sReturn \; M ]_{\sPid_\mathit{to}} \sPar \sProcesses}
227 {\sQueue, \sQueue'}
219 {\sQueue, \sQueue'}
228 {\sBlacklist}
220 {\sBlacklist}
229} \textsc{Expect}
221} \textsc{Expect}
@@ -231,33 +223,37 @@ We return the \emph{first} message of a randomly chosen sender.
232\subsubsection{Spawning}
224\subsubsection{Spawning}
226+Spawning is asynchronous
234\begin{equation*}
228\begin{equation*}
236− \sPid' \text{ fresh} \qquad
230+ \text{\sRef fresh}
237− (\sNid, \sPid) \notin \sBlacklist
239− \sSystem{\sCtxt{P}[ \sSpawn \; \sNid \; M ]_\sPid[\sProcesses]_\sNid}
232+ \sSystem{\sCtxt{E}[ \sSpawn \; \sNid \; M ]_\sPid \sPar \sProcesses}
240 {\sQueue}
233 {\sQueue}
241 {\sBlacklist}
234 {\sBlacklist}
242\rightarrow
235\rightarrow
243− \sSystem{\sCtxt{P}[ \sReturn \; (\sJust{\sPid'}) ]_\sPid[\sProcesses \sPar M_{\sPid'}]_\sNid}
236+ \sSystem{\sCtxt{E}[ \sReturn \; \sRef ]_\sPid \sPar \sProcesses}
244− {\sQueue}
237+ {\sQueue \sExtend{\sBlacklist} (\sNid, \sPid, \sSpawn \; \sRef \; M)}
245 {\sBlacklist}
238 {\sBlacklist}
246−} \textsc{Spawn-Ok}
239+} \textsc{Spawn-Async}
247\end{equation*}
240\end{equation*}
249\begin{equation*}
243\begin{equation*}
251− (\sNid, \sPid) \in \sBlacklist
245+ \sPid \notin \sSenders(\sQueue)
247+ \text{$\sPid'$ fresh}
253− \sSystem{\sCtxt{P}[ \sSpawn \; \sNid \; M ]_\sPid}
249+ \sSystem{\sProcesses}
254− {\sQueue}
250+ {\sQueue, (\sNid, \sPid, \sSpawn \; \sRef \; M), \sQueue'}
255 {\sBlacklist}
251 {\sBlacklist}
256−\rightarrow
252+\rightarrow
257− \sSystem{\sCtxt{P}[ \sReturn \; \sNothing ]_\sPid}
253+ \sSystem{\sProcesses \sPar M_{\sPid'}}
258− {\sQueue}
254+ {\sQueue, \sQueue' \sExtend{\sBlacklist} (\sPid, \sNid, \sSpawned \; \sRef \; \sPid')}
259 {\sBlacklist}
255 {\sBlacklist}
260−} \textsc{Spawn-No}
256+} \textsc{Spawn-Reply}
261\end{equation*}
257\end{equation*}
263\subsubsection{Reconnect}
259\subsubsection{Reconnect}
@@ -265,28 +261,14 @@ We return the \emph{first} message of a randomly chosen sender.
265\begin{equation*}
261\begin{equation*}
268− \sSystem{\sCtxt{P}[ \sReconnect \; \mathit{id} ]_\sPid}
264+ \sSystem{\sCtxt{P}[ \sReconnect \; \sId_\mathit{to} ]_{\sPid_\mathit{fr}}}
270− {\sBlacklist, (\mathit{id}, \sPid), \sBlacklist'}
272− \sSystem{\sCtxt{P}[ \sReturn \; () ]_\sPid}
274− {\sBlacklist, \sBlacklist'}
275−} \textsc{Reconnect-Ok}
280− (\mathit{id}, \sPid) \notin \sBlacklist
282− \sSystem{\sCtxt{P}[ \sReconnect \; \mathit{id} ]_\sPid}
283 {\sQueue}
265 {\sQueue}
284 {\sBlacklist}
266 {\sBlacklist}
285\rightarrow
267\rightarrow
286 \sSystem{\sCtxt{P}[ \sReturn \; () ]_\sPid}
268 \sSystem{\sCtxt{P}[ \sReturn \; () ]_\sPid}
287 {\sQueue}
269 {\sQueue}
288− {\sBlacklist}
270+ {\sBlacklist \backslash (\sPid_\mathit{to}, \sPid_\mathit{fr})}
289−} \textsc{Reconnect-No}
271+} \textsc{Reconnect}
290\end{equation*}
272\end{equation*}
292\subsubsection{Administration}
274\subsubsection{Administration}