On Jun 25, 2009, at 05:01 , Magicloud Magiclouds wrote:
 In many language, both thread and process are supported. But in
haskell's document, the only thing I could find called fork is to make
a thread. So how to fork the program itself, like fork () in C?


Internal threads can be done reasonably portably (well, assuming you don't look at the internals of the runtime :) but fork() is specific to POSIX/Unix-like systems. (I'm told you can emulate it on Windows but it's neither fast nor easy; on most non-Unixlike systems the native operation is to spawn a process running a new executable, and cloning the current process is unusual at best.)

As such, forkProcess lives in System.Posix.Process, along with executeFile (overlaying the current process's executable image is likewise a Unixism) and other operations specific to the POSIX/Unix- like process model.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to