[Haskell-cafe] Re: Bug in runInteractiveProcess?
Stefan O'Rear
stefanor at cox.net
Wed Oct 17 21:11:12 EDT 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071017/f5bbd1b7/attachment.bin
More information about the Haskell-Cafe
mailing list