[Haskell-cafe] Parallel programming in Haskell (threads, cores, processors)

Mark Spezzano valheru at chariot.net.au
Tue Mar 10 22:08:55 EDT 2009



I’m an experienced software developer, but a bit of a newbie when it comes
to parallel processing in any language.


I’ve done some multithreading in Java and C++ on a single processor, single
core architecture only.


First, let me define some terms:


Multithreading: this is multiple processes running on one processor and is
the conventional way to do parallel programming

Multicore: this is when we have two (or more) cores within the one CPU

Multiprocessor: this is when we have multiple CPUs


Question 1:

Is there any programmatic change in dealing with multiple threads as opposed
to multiple cores in most languages (specifically Haskell)?


That is, to write multiple threads you normally “spin-off” a new thread
which runs in parallel along with other threads. Is Haskell smart enough to
do this by magic by itself, or would I need to tell it explicitly : Run
thread A whilst running thread B 


Also, what about multicore architectures? Do I have to tell the language to
spin off two separate programs to run on each core and then somehow use some
kind of communications to exchange data? 


I also assume that, in theory it would be possible to have multiple threads
running on each core. Say, 3 threads spawned from program 1 running on core
1 and 5 threads on program 2 running on core 2


Likewise I would suppose that it would be possible to have multiprocessors,
each potentially multicore, each core running multiple threads.


Question 2:


In light of the above  statement, is the programmatic change DIFFERENT for
dealing with each of 

a)      Multithreading in Haskell versus

b)      Multicores in Haskell verus

c)       Multiprocessors in Haskell



References or info appreciated.


Just curious.




No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.557 / Virus Database: 270.11.9/1993 - Release Date: 10/03/2009
7:19 AM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090311/a94320f6/attachment.htm

More information about the Haskell-Cafe mailing list