[Haskell] Pugs gains SMP parallelism support.

Audrey Tang autrijus at gmail.com
Sat Oct 21 18:02:56 EDT 2006


=A6b Oct 21, 2006 9:58 AM =AE=C9=A1ATaral =BCg=A8=EC=A1G

> On 10/21/06, Audrey Tang <autrijus at gmail.com> wrote:
>> I wonder if there is a more efficient way doing this...
>
> I would use an IOArray:
>
> let l =3D length xs
> arr <- newArray_ (0, l)
> count <- newQSemN 0
> let proc n x =3D do
>    rv <- runEvalIO env (reduce x)
>    writeArray arr n rv
>    signalQSemN count 1
> sequence_ $ zipWith proc [0..] xs
> waitQSemN count l
> elems $ unsafeFreeze arr

Hmm, am I missing something here, but how does forkIO (and data =20
parallelism) fit in into that scheme?

Thanks,
Audrey



More information about the Haskell mailing list