6/257
\begin{frame}
\frametitle{Concurrent Access}

\begin{itemize}
\item My wife has a credit card for the same account.
\item What if we use the cards at the same time (concurrently)?
\end{itemize}
\pause

\begin{exampleblock}{Concurrent ATM Transaction}
\begin{tcenter}
\begin{tabular}{|l|l|c|}
\hline
\emph{me}
& \emph{my wife}
& \emph{DB state} \\
\hline
$\var{bal} \set \fun{read}(\var{acct})$
&
& 1200 \\
& $\var{bal} \set \fun{read}(\var{acct})$
& 1200 \\
$\var{bal} \set \var{bal}-100$
&
& 1200 \\
& $\var{bal} \set \var{bal}-200$
& 1200 \\
& $\fun{write}(\var{acct}, \var{bal})$
& 1000 \\
$\fun{write}(\var{acct}, \var{bal})$
&
& 1100 \\
\hline
\end{tabular}
\end{tcenter}
\end{exampleblock}
\pause

The update of my wife was lost during this execution. Lucky me!