Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Latex sample for algorithm implementation, as used in CS-451 Distributed Algorithms
\begin{alltt}
\normalfont
\textbf{Implements}:
UniformReliableBroadcast, \textbf{instance} \textit{urb}.
\textbf{Uses}:
IdealPerfectPointToPointLinks, \textbf{instance} \textit{idealpl}.
\textbf{upon event} \textit{\(<\)urb, Init\(>\)} \textbf{do}
\textit{delivered} := \(\emptyset\);
\textbf{upon event} \textit{\(<\)urb, Broadcast \(|\) \textit{m}\(>\)} \textbf{do}
\textbf{trigger} \textit{\(<\)idealpl, Send \(|\) self, (DATA, self, m)\(>\)};
\textbf{upon event} \textit{\(<\)idealpl, Deliver \(|\) p, (DATA, s, m)\(>\)} \textbf{do}
\textbf{if} \textit{m} \(\not\in\) \textit{delivered} \textbf{then}
\textit{delivered} := \textit{delivered} \(\cup\) (\textit{m});
\textbf{forall} \textit{q} \(\in \Pi\)
\textbf{trigger} \textit{\(<\)idealpl, Send \(|\) q, (DATA, s, m)\(>\)};
\textbf{trigger} \textit{\(<\)urb, Deliver \(|\) s, m\(>\)};
\end{alltt}
@adizere

This comment has been minimized.

Copy link
Owner Author

commented Oct 28, 2015

Yields the following snippet:

screen shot 2015-10-28 at 12 58 01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.