
Hi, 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? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞

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] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (2)
-
Brandon S. Allbery KF8NH
-
Magicloud Magiclouds