Quoting Erik de Castro Lopo : > Michael Gogins wrote: > >> The Glasgow Haskell Compiler does appear to support parallel execution >> of concurrent code. >> >> Does anyone on this list have any personal experience with this feature? > > My experience is second hand. A member of the Sydney function > programming group (FP-Syd), Manuel Chakravarty was part of the > team that implemented the latest Nested Data Parallel (NDP) stuff > in the GHC compiler. > > Manuel gave a presentation at FP-Syd late last year and at that stage > the NDP stuff was basically working but still had a few problems in > the runtime that was hindering performance. However, he seemed > confident that these problems would be overcome in the near future. > > Basically its not there quite yet, but could well be there soon. > Those problems may have been related to the parallel garbage collector (more specifically, GHC's lack of it). It was implemented in GHC 6.10.1, but had some serious performance penalties that were fixed in 6.10.2. Haskellers seem to have specific conceptions of the terms "parallel" and "concurrent" that are more precise than what I'd encountered previously. Quoting GHC docs from memory, parallelism is about making programs run faster whereas concurrency is about communication between simultaneously running threads/processes. Concurrency support has a lot of the usual concurrency primitives (sparking threads, locks, semaphores, etc.), with some more sophisticated interfaces built on top, notably the Software Transactional Memory package. Of more interest to me is the parallel interface, which allows specifying that computations can be run in parallel, or one must be run before another, etc. I have used this a bit myself, and the results have been pretty good. The Control.Parallel.Strategies module (standard with GHC) defines a lot of parallel-related functions, and they're pretty easy to work with. For example, if you have a filter function you wish to apply to several chunks of data, you can use the following: filteredChunks = parMap rnf filterfunction datachunks and now the application of "filterfunction" to each chunk in the "datachunks" list will be performed in parallel. parMap specifies you are performing a map (applying a function to every element of a list) in parallel. rnf means you wish to reduce the data to "normal form", i.e. fully evaluate the expression. Don Stewart's blog has a small writeup on creating a parallelized Fibonacci program at http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/29#smoking-4core. It provides a bit more context than this, as well as various real-world considerations. The Nested Data Parallelism stuff is now called DPH (Data Parallel Haskell) and is also shipped standard with GHC. I haven't used it because it's not clear to me that it would be very useful for real-time work, although for non-real-time it could be seriously powerful. John L.