[Haskell-cafe] forkIO on multicore

Paul Keir pkeir at dcs.gla.ac.uk
Fri Dec 19 12:16:27 EST 2008


I did indeed intend for the threads to evaluate before writing to the
two variables, thanks.

> heavytask m = putMVar m $! (fibs !! 100000)

I now see a time difference, but as you suggested, in the wrong
direction (1.5s for one, and 3.6s for two threads). I was hoping
for each thread to independently calculate a fib number (but only
to easily give them something to do) . Are the threads really in
competition though? I'm hoping for each thread to write its own result;
so giving the same answer twice. With the "-N2" and "-threaded"
switches,
can I not expect each thread to run on a separate core?

Paul


More information about the Haskell-Cafe mailing list