Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!decvax!mcnc!rti-sel!dg_rtp!throopw From: throopw@dg_rtp.UUCP Newsgroups: comp.lang.c Subject: Re: Fork and Exec Message-ID: <1576@dg_rtp.UUCP> Date: Sat, 4-Apr-87 14:49:57 EST Article-I.D.: dg_rtp.1576 Posted: Sat Apr 4 14:49:57 1987 Date-Received: Sun, 5-Apr-87 19:56:56 EST References: <6635@brl-adm.ARPA> <215@pyuxe.UUCP> Lines: 62 > joecar@pyuxe.UUCP >> bagpiper@csvax.caltech.edu >> What is the difference between fork and exec in a unix environment and >> furthermore how does that map into a MS-Dos environment?? > I understand the difference between fork and exec system calls, but > I'd like to expand the question and ask if anyone can help me understand > the mapping of fork-exec and/or fork-exec-wait sequences to other non-UNIX > computing environments like MVS, VM, VMS, and as the other article > asks, MS-DOS. I'll talk about how Unix-style fork() and exec() map to AOS/VS (Data General) operations. But first, we have to get a handle on what operations we are talking about here. There are really three. There is "create a process", "load an executable image", and (most difficult for AOS/VS) "duplicate a process's executable image". In Unix, fork() == "create a process" & "duplicate a process's executable image" exec() == "load an executable image" Whereas on AOS/VS, ?PROC == "create a process" & "load an executable image" ?CHAIN == "load an executable image" You can see that AOS/VS has no notion of the duplication of a running process's address space. Luckily, it is possible to implement this operation as a user-level operation under AOS/VS. In fact, fork() can be simulated on AOS/VS by ?PROC (loading a very simple image, which in turn copies it's parent's address space), and exec() maps almost directly into ?CHAIN. Note that Berkeley's vfork() operation is close to "create a process" alone, without loading or duplicating an image. This means that systems that have vfork(), fork(), and exec() come fairly close to separating out the three functions. For sure, they have the common cases covered. Further note that the issues of what to do with open files, IPC connections, and other non-memory-image state-of-a-process when each of these three operations occur muddies up this clear picture quite a bit. > madd@bucsb.bu.edu (Jim Frost) > When you call exec, MS-DOS loads the new program > into a new space, and gives it control. When it terminates, control > is returned to the parent process. This is much more primitive than > in unix. I'll pick a nit here. It is *not* more primitive than the Unix operations. In fact, the whole reason that the Unix operations are superior is that they ARE more primitive. They come closer to performing only one operation each. For this reason, the Unix operations are more powerful and flexible, *because* they are more primitive. -- "You've got three minutes to talk, or my friend here'll get angry." "Grrrrrrrrrr." --- Galaxy Rangers -- Wayne Throop !mcnc!rti-sel!dg_rtp!throopw