John Goerzen wrote:
On Mon, Mar 05, 2007 at 03:20:05PM +0000, Ian Lynagh wrote:
>From reading the docs, it sounds like forkIO keeps everything in a
single OS thread/process.  Doesn't this mean that a program that uses
forkIO instead of forkOS loses out on SMP machines?
You can use e.g. +RTS -N2 to use 2 OS threads.

That's rather ugly though, and doesn't "just work".  With other
languages, I could just use OS threads, and let the OS schedule, say, 15
threads across 2 CPUs, or 4 CPUs, or however I may have.

-- John


Choice is good, but it does mean the default may need to be tweaked, such as with those options.

The main difference in how lightweight or heavyweight the threads are. Lightweight forkIO threads allow for tremendous performance, see the benchmarks here:

http://shootout.alioth.debian.org/gp4/benchmark.php?test=chameneos&lang=all

http://shootout.alioth.debian.org/gp4/benchmark.php?test=message&lang=all

Those benchmarks are without using a "+RTS -N2" style thread pool.

--
Chris
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to