[Haskell-cafe] Basic questions about concurrency in Haskell

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Aug 5 14:13:09 EDT 2009

Hello Thomas,

Wednesday, August 5, 2009, 9:59:00 PM, you wrote:

> because it provides facilities for concurrency on the language level,
> and I'm mainly interested in implementing parallel or massively
> parallel algorithms with Haskell. I have two questions that bother me.

if you plan to implement high-performance low-level algos, haskell/ghc
is definitely not the language you need. haskell concurrency features
are great in erlang-style situations when you need to manage many
threads that interacts in complex way. but don't expect to get any
C-level performance

> 1. Does the Haskell compiler make sure that there is no page sharing
> between threads


> 2. I started with the very simple nfib example given in the manual for
> Control.Parallel (Section 7.18).

standard optimization for this example is to use par only for large
enough n, otherwise you will lose much more time on synchronization.
ghc doesn't parallelize code in some wizardry way, it just have 4
worker threads, for example, and each spark created with par, becomes
one more job for these threads o execute

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list