\begin{slide}{Philosophen mit STM}

kein Deadlock (trivial).
\begin{verbatim}
forM [ 1 .. num ] $ \ p -> forkIO $ forever $ do
    atomically $ do 
        take $ left  p
        take $ right p
    atomically $ drop $ left  p
    atomically $ drop $ right p
take f = do
    busy <- readTVar f
    when busy $ retry
    writeTVar f True
\end{verbatim}
nicht fair. 
  
\end{slide}
