[Haskell-cafe] System threads?

Lyle Kopnicky lists at qseep.net
Tue Sep 19 22:45:47 EDT 2006


Hi folks,

I'm working on a project for which the solution is highly 
parallelizable. I've been writing it so far for GHC as a single-threaded 
app. I'd like to be able to split the job into multiple pieces, and 
spawn different system threads for each piece, so they will run on 
separate CPUs. Either each thread needs to write to the same IO handle, 
or else the results need to be collected when the threads are merged, so 
the results can all be printed.

I'm working on Linux. What's the easiest way to accomplish this? Glasgow 
Parallel Haskell? Is there a Posix.Threads library? I understand that 
Haskell threads (Control.Concurrent) all run in one system thread, so 
would not take advantage of SMP.

I suppose in the worst case I can write a shell program that divides up 
the problem, runs several worker processes to output intermediate 
results to files, then combines the results to the desired filehandle.

Thanks,
Lyle


More information about the Haskell-Cafe mailing list