On Wed, Oct 17, 2007 at 08:46:41AM -0700, Donn Cave wrote: > On Wed, 17 Oct 2007, Simon Marlow wrote: > ... > > Note that forkProcess doesn't currently work with +RTS -N2 (or any value > > larger than 1), and it isn't likely to in the future. I suspect > > forkProcess should be deprecated. > > > > The POSIX spec is pretty strict about what system calls you can make in the > > child process of a fork in a multithreaded program, and those same > > restrictions apply in Haskell, and they apply not only to the Haskell code > > but also to the runtime (e.g. what if the child process needs more memory > > and the runtime calls mmap(), that's not allowed). We get away with it > > most of the time because the OSs we run on are less strict than POSIX. > > However, in general I think forking should be restricted to C code that you > > invoke via the FFI. > > Just to be precise about it, though, there's nothing about Haskell per se > that causes trouble with fork, right? This is a GHC implementation issue.
Forking in the presense of multiple threads is a semantic nightmare. Anything any Haskell implementation does is going to be wrong in at least two ways, so it's probably best not to try. Write your fork-child code in C. Stefan
signature.asc
Description: Digital signature
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe