[Haskell-cafe] True parallelism missing :-(

Roberto Zunino zunino at di.unipi.it
Tue Mar 25 10:38:38 EDT 2008

Dusan Kolar wrote:
> Dear all,
>  I've thought the following three (dummy) programs would run some of 
> their parts in parallel (on dual core) if compiled with option threaded 
> (smp). The truth is that only the first one exploits multicore CPU. Why?

>          h1 <- forkIO $ putMVar v1 $ fibs (n-1)

You are putting an unevaluated thunk in the MVar. Try:

h1 <- forkIO (putMVar v1 $! fibs (n-1))


More information about the Haskell-Cafe mailing list