Last active
September 26, 2016 13:22
-
-
Save adizere/bf7423045e05aa53c4f3 to your computer and use it in GitHub Desktop.
Latex sample for algorithm implementation, as used in CS-451 Distributed Algorithms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yields the following snippet: