21/257
\begin{frame}
  \frametitle{Anomalies: Dirty Read}
  
  Again, my wife and I are doing a transaction at the same time.
  \smallskip
  
  This time, \emph{my transaction gets cancelled}!
  \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 \var{bal}-100$
     & 
     & 1200 \\
    $\fun{write}(\var{acct}, \var{bal})$
     & 
     & 1100 \\
     & $\var{bal} \set \fun{read}(\var{acct})$
     & 1100 \\
     & $\var{bal} \set \var{bal}-200$
     & 1100 \\
    \alert{abort}
     & 
     & 1200 \\
     & $\fun{write}(\var{acct}, \var{bal})$
     & 900 \\
    \hline
    \end{tabular}
    \end{tcenter}
  \end{exampleblock}
  \pause
  
  \begin{alertblock}{}
    My wife's transaction has already read the modified account balance
    before my transaction was \emph{rolled back} (i.e., the effect are undone).
  \end{alertblock}
\end{frame}