ADoverAB v2
This commit is contained in:
@ -1,14 +1,43 @@
|
||||
We define $k$ as the id of the round \\
|
||||
the $getMax(..)$ function able to return the highest round played in the system.
|
||||
the $getMax(proves)$ return $MAX({(\_, r) : \exists (\_, PROVE(r)) \in proves})$ \\
|
||||
$buffer$ a FIFO list with $buffer[front]$ returning the first element
|
||||
|
||||
% \begin{algorithm}[H]
|
||||
% \DontPrintSemicolon
|
||||
% \SetAlgoLined
|
||||
% \KwIn{le message $m$}
|
||||
% \BlankLine
|
||||
% \While{true}{
|
||||
% proves = READ() \\
|
||||
% k = getMax(dump) + 1 \\
|
||||
% APPEND(k || m) \\
|
||||
% \If{PROVE(k)}{
|
||||
% APPEND(k) \\
|
||||
% return
|
||||
% }
|
||||
% }
|
||||
% \caption{AB\_Broadcast}
|
||||
% \end{algorithm}
|
||||
|
||||
\begin{algorithm}[H]
|
||||
\DontPrintSemicolon
|
||||
\SetAlgoLined
|
||||
\KwIn{le message $m$}
|
||||
\BlankLine
|
||||
k\_max = getMax(READ()) \\
|
||||
\While{buffer $\neq [\emptyset] $}{
|
||||
(i, m) = buffer[front] \\
|
||||
\textbf{wait} PROVE(k\_max || m) = false \\
|
||||
proves = READ() \\
|
||||
\If{$((i, PROVE(k\_max || m)) \in proves) \wedge ((i, PROVE(k\_max)) \in proves)$}{
|
||||
$buffer = buffer - \{(i, m)\}$
|
||||
}
|
||||
}
|
||||
\BlankLine
|
||||
\While{true}{
|
||||
proves = READ() \\
|
||||
k = getMax(dump) + 1 \\
|
||||
k = getMax(proves) + 1 \\
|
||||
PROVE(k || m) \\
|
||||
APPEND(k || m) \\
|
||||
\If{PROVE(k)}{
|
||||
APPEND(k) \\
|
||||
@ -18,29 +47,55 @@ the $getMax(..)$ function able to return the highest round played in the system.
|
||||
\caption{AB\_Broadcast}
|
||||
\end{algorithm}
|
||||
|
||||
We define $k\_max$ as an intager \\
|
||||
$getMax(..)$ function able to return the highest round played in the system. \\
|
||||
% $proves_r$ as the sub set of proves with only the valid proves associated to the round r \\
|
||||
$proves_r \subseteq proves$ s.a. $\forall PROVE(x) \in proves_r$, x is in the form $r || m$ with $m$ who cannot be empty \\
|
||||
$proves_r^i$ is the $PROVE(r || m )$ operation submited by the process i if exist \\
|
||||
$proves_r = {(i, r) : \forall i, \exists (i, PROVE(r)) \in proves}$ \\
|
||||
$proves_r^i = ((i, r) : \exists (i, PROVE(r)) \in proves)$ ?? NULL \\
|
||||
|
||||
% $proves_r \subseteq proves$ s.a. $\forall PROVE(x) \in proves_r$, x is in the form $r || m$ with $m$ who cannot be empty \\
|
||||
% $proves_r^i$ is the $PROVE(r || m )$ operation submited by the process i if exist \\
|
||||
|
||||
\begin{algorithm}[H]
|
||||
\DontPrintSemicolon
|
||||
\SetAlgoLined
|
||||
buffer = $[\emptyset]$ \\
|
||||
k = 0 \\
|
||||
\BlankLine
|
||||
\While{true}{
|
||||
proves = READ() \\
|
||||
k\_max = getMax(proves) \\
|
||||
\For{r=k+1 \emph{\KwTo} k\_max}{
|
||||
APPEND(r)\\
|
||||
$proves_r$ = \{$\forall i, PROVE(r)_i \in READ()$\} \\
|
||||
\For{i = 1 \emph{\KwTo} $|P|$}{
|
||||
\If{$\exists PROVE(r)_i \in proves_r$}{
|
||||
AB\_Recv($m$ s.t. $PROVE(r || m) \in proves$)
|
||||
\If{$(\exists m : \exists(i, PROVE(r || m)) \in proves)$}{
|
||||
\uIf{$(\exists(i, PROVE(r)) \in proves)$} {
|
||||
AB\_Recv(m)
|
||||
}
|
||||
\Else{
|
||||
$buffer = buffer \cup \{(i, m)\}$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
\caption{AB\_Listen}
|
||||
\end{algorithm}
|
||||
|
||||
\caption{AB\_Listen}
|
||||
\end{algorithm}
|
||||
% \begin{algorithm}[H]
|
||||
% \DontPrintSemicolon
|
||||
% \SetAlgoLined
|
||||
% \BlankLine
|
||||
% \While{true}{
|
||||
% proves = READ() \\
|
||||
% k\_max = getMax(proves) \\
|
||||
% \For{r=k+1 \emph{\KwTo} k\_max}{
|
||||
% APPEND(r)\\
|
||||
% $proves_r$ = \{$\forall i, PROVE(r)_i \in READ()$\} \\
|
||||
% \For{i = 1 \emph{\KwTo} $|P|$}{
|
||||
% \If{$\exists PROVE(r)_i \in proves_r$}{
|
||||
% AB\_Recv($m$ s.t. $PROVE(r || m) \in proves$)
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% \caption{AB\_Listen}
|
||||
% \end{algorithm}
|
Reference in New Issue
Block a user