Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!brunix!phg From: phg@cs.brown.edu (Peter H. Golde) Newsgroups: comp.arch Subject: Re: fork() Message-ID: <31329@brunix.UUCP> Date: 2 Mar 90 22:33:33 GMT References: <37873@cornell.UUCP> Sender: news@brunix.UUCP Reply-To: phg@cs.brown.edu (Peter H. Golde) Distribution: comp Organization: Brown University Department of Computer Science Lines: 24 In article <37873@cornell.UUCP> huff@cs.cornell.edu (Richard Huff) writes: >I guess that most people are used to using fork() and not having a >shared address space between processes. We could eliminate fork() and >exec() in favor of create() and activate(), where: >......... I fail to see what is wrong the simplest solution of all: Just a spawn(program, argv, envp) call. To change the childs file handles, for example, you a) switch your file handles around b) spawn the child c) switch your file handle back This is easy to do with dup() and dup2(). Other things can be handled similarly.. More complex uses of fork can be done better using multiple threads (lightweight processes). OS/2 for one uses this approach, and it seems to be pretty easy to use, without the goofiness and peformance problems of fork(), which can be considerable on some architectures. --Peter Golde