Skip to content

Commit 605f148

Browse files
committed
Replace the execution results of code with LaTeX table syntax
1 parent 81c105d commit 605f148

File tree

1 file changed

+44
-13
lines changed

1 file changed

+44
-13
lines changed

concurrency-primer.tex

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -794,19 +794,50 @@ \subsubsection{Sequential consistency (SC)}
794794
\end{ccode}
795795

796796
If this program satisfies sequential consistency, then for Thread 1, \monobox{x = 1} must occur before \monobox{y = 1}, and for Thread 2, \monobox{r1 = y} must occur before \monobox{r2 = x}.
797-
For the entire program, the following six execution orders are possible:
798-
799-
\begin{verbatim}
800-
| x = 1 | x = 1 | x = 1 |
801-
| y = 1 | r1 = y(0) | r1 = y(0) |
802-
| r1 = y(1) | y = 1 | r2 = x(1) |
803-
| r2 = x(1) | r2 = y(1) | y = 1 |
804-
+-------------------+-------------------+-------------------+
805-
| r1 = y(0) | r1 = y(0) | r1 = y(0) |
806-
| x = 1 | x = 1 | r2 = x(0) |
807-
| y = 1 | r2 = x(1) | x = 1 |
808-
| r2 = x(1) | y = 1 | y = 1 |
809-
\end{verbatim}
797+
For the entire program, the following six execution orders are possible:
798+
799+
\begin{center}
800+
\noindent
801+
\begin{tabular}{|c|c|c|} \hline
802+
\begin{lstlisting}
803+
x = 1
804+
y = 1
805+
r1 = y(1)
806+
r2 = x(1)
807+
\end{lstlisting}&
808+
\begin{lstlisting}
809+
x = 1
810+
r1 = y(0)
811+
y = 1
812+
r2 = y(1)
813+
\end{lstlisting}&
814+
\begin{lstlisting}
815+
x = 1
816+
r1 = y(0)
817+
r2 = x(1)
818+
y = 1
819+
\end{lstlisting}\\ \hline
820+
\begin{lstlisting}
821+
r1 = y(0)
822+
x = 1
823+
y = 1
824+
r2 = x(1)
825+
\end{lstlisting}&
826+
\begin{lstlisting}
827+
r1 = y(0)
828+
x = 1
829+
r2 = x(1)
830+
y = 1
831+
\end{lstlisting}&
832+
\begin{lstlisting}
833+
r1 = y(0)
834+
r2 = x(0)
835+
x = 1
836+
y = 1
837+
\end{lstlisting}\\ \hline
838+
\end{tabular}
839+
\captionof{table}{6 possible execution orders of the message passing litmus test.}
840+
\end{center}
810841

811842
Observing these orders, we see that none result in \monobox{r1 = 1} and \monobox{r2 = 0}.
812843
Thus, sequential consistency only allows the outcomes \monobox{(r1, r2)} to be \monobox{(1, 1)}, \monobox{(0, 1)}, and \monobox{(0, 0)}.

0 commit comments

Comments
 (0)