[Haskell-cafe] True parallelism missing :-(

Don Stewart dons at galois.com
Tue Mar 25 16:46:09 EDT 2008


To avoid this in future, you can use the strict-concurrency
package on hackage, which has some stricter container types, with
their strategies. MVars and Chans are the main examples of where
a stricter strategy is sometimes useful.

kolar:
> Yes, that's is. Thanks. My fault - missing wood seeing trees. ;-)
> 
> Best regards,
> 
> Dusan
> 
> Roberto Zunino wrote:
> >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))
> >
> >Zun.
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list