9/257
\begin{frame}
  \frametitle{Interrupted Transactions (e.g. the Plug is Pulled)}
  
  I want to \emph{transfer money from checking to saving}:
  \medskip
  
  \begin{exampleblock}{Money Transfer}
    \hint{// Subtract money from source (checking) account}
    \nr{1}$\var{checking\_balance} \set \fun{read\_balance}(\var{checking\_account\_no})$\\
    \nr{2}$\var{checking\_balance} \set \var{checking\_balance}-500$\\
    \nr{3}$\fun{write\_balance}(\var{checking\_account\_no}, \var{checking\_balance})$\\
    \medskip
    
    \hint{// Add money to the target (saving) account}
    \nr{4}$\var{saving\_balance} \set \fun{read\_balance}(\var{saving\_account\_no})$\\
    \nr{5}$\var{saving\_balance} \set \var{saving\_balance}+500$\\
    \nr{6}\mpause[1]{\alert{System crash!}
    \nr{7}}$\fun{write\_balance}(\var{saving\_account\_no}, \var{saving\_balance})$\\
  \end{exampleblock}
  \pause\bigskip
  
  Before the transaction gets to step $7$, the execution is interrupted.
  (power outage, disk failure or software bug)
  \pause
  
  \begin{alertblock}{}
    My money is lost!
  \end{alertblock}
\end{frame}