8/212
\begin{frame}[t]
  \frametitle{Interrupted Transactions}
  
  \vspace{-1ex}
  \begin{exampleblock}{Money Transfer from Checking to Saving}
    \hint{Subtract money from source (checking) account:}
    \nr{1}$\var{checking\_balance} \set \fun{read}(\var{checking\_account})$\\
    \nr{2}$\var{checking\_balance} \set \var{checking\_balance}-500$\\
    \nr{3}$\fun{write}(\var{checking\_account}, \var{checking\_balance})$\\
    \smallskip
    
    \hint{Add money to the target (saving) account:}
    \nr{4}$\var{saving\_balance} \set \fun{read}(\var{saving\_account})$\\
    \nr{5}$\var{saving\_balance} \set \var{saving\_balance}+500$\\
    \only<2->{\alert{System crash!\\}}
    \nr{6}$\fun{write}(\var{saving\_account}, \var{saving\_balance})$\\
  \end{exampleblock}
  \pause\smallskip
  
  Before the transaction gets to step $6$, the system crashes.\\
  (power outage, disk failure or software bug)
  \pause
  
  \begin{alertblock}{}
    My money is lost!
  \end{alertblock}
  \pause

  \begin{goal}{}
    Transactions should be \emph{atomic} (executed fully or not at all).
  \end{goal}
  \vspace{10cm}
\end{frame}