101/212
\begin{frame}
  \frametitle{Example: ATM Transaction}

  \begin{exampleblock}{Concurrent ATM Transaction}
    \begin{tcenter}
    \begin{tabular}{|l|l|c|}
    \hline
    \emph{Transaction 1} & \emph{Transaction 2} & \emph{DB state} \\
    \hline
    & & \\
    \textcolor{dgreen}{$\fun{xlock}(\var{account})$} &  & 1200 \\
    $\fun{read}(\var{account})$ &  & \\
    & \textcolor{gray}{$\fun{xlock}(\var{account})$} & \\
    $\fun{write}(\var{account})$ & \multirow{2}{*}{
      \begin{tikzpicture}
        \draw [red,very thick,->] (0,0) -- node [right,align=left] {Transaction\\[.5ex]blocked} (0,-.8cm);
      \end{tikzpicture}} & 1100 \\
    \textcolor{dgreen}{$\fun{unlock}(\var{account})$} &  & \\
    & \textcolor{dgreen}{$\fun{xlock}(\var{account})$}  & \\
    & $\fun{read}(\var{account})$ &  \\
    & $\fun{write}(\var{account})$ & 900 \\
    & \textcolor{dgreen}{$\fun{unlock}(\var{account})$} &  \\
    \hline
    \end{tabular}
    \end{tcenter}
  \end{exampleblock}
  
  \begin{goal}{}
    Transaction 2 blocked until transaction 1 releases the lock.
  \end{goal}
  
  Note: now both transactions are correctly executed!
\end{frame}

%\overview{4}
\theme{\\Two Phase Locking - Deadlock Handling}