[Haskell] Pugs gains SMP parallelism support.

Audrey Tang autrijus at gmail.com
Sat Oct 21 04:14:49 EDT 2006


I hacked +RTS -N support into Pugs today; here's a short writeup:
     http://pugs.blogs.com/pugs/2006/10/smp_paralleliza.html

Pugs's current implementation for concurrent operations on lists is  
very naive:

             chan    <- newChan
             forM ([0..] `zip` xs) $ \(n, x) -> forkIO $ do
                 rv  <- runEvalIO env (reduce x)
                 writeChan chan (n, rv)
             fmap (map snd . sort) (replicateM (length xs) (readChan  
chan))

While the initial result on Linux 2.6 is encouraging, on OSX/Intel  
with two CPUs
it actually slightly slows down the program when running on -N2 or  
above.
I wonder if there is a more efficient way doing this...

Thanks,
Audrey



More information about the Haskell mailing list