17/212
\begin{frame}
  \frametitle{Concurrent Access: 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{state} \\
    \hline
    $\var{balance} \set \fun{read}(\var{account})$
     & 
     & 1200 \\
    $\var{balance} \set \var{balance}-100$
     & 
     & 1200 \\
    $\fun{write}(\var{account}, \var{balance})$
     & 
     & 1100 \\
     & $\var{balance} \set \fun{read}(\var{account})$
     & 1100 \\
     & $\var{balance} \set \var{balance}-200$
     & 1100 \\
    \alert{abort}
     & 
     & 1200 \\
     & $\fun{write}(\var{account}, \var{balance})$
     & 900 \\
    \hline
    \end{tabular}
    \end{tcenter}
  \end{exampleblock}
  \pause
  
  \begin{alertblock}{}
    My wife's transaction has read the modified balance
    before my transaction was \emph{rolled back} (i.e., the effects are undone).
  \end{alertblock}

  \pause
  \begin{goal}{}
    This is known as \emph{dirty read anomaly}.
  \end{goal}
\end{frame}