delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/15/17:22:46

To: SGW46959M021 AT daffy DOT millersv DOT edu
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: fork()
Date: Fri, 15 Jul 1994 13:47:23 PDT
From: "Marty Leisner" <leisner AT sdsp DOT mc DOT xerox DOT com>

In message <940715155304 DOT 509 AT DAFFY DOT MILLERSV DOT EDU>you write:
>
>S. Walizer writes:
>
>		Just a curiosity question: are there any future plans to
>	incorporate a functional fork() into djgpp? Maybe in 2.0? It seems to
>	me the necessary features could be incorporated into go32. I would
>	attempt it myself, but I know my skills and time are not up to the
>	task.
>
>Perhaps we have different ideas of what a "functional fork()" is.  On
>UNIX, fork() creates a copy of the running process.  Since DOS is not
>a multitasking OS, I don't see how this could be done for DJGPP.
>
>Dave
>
>It is entirely possible to accomplish under DOS. Multitasking can be done
>outside of the OS, as packages such as CTask indicate. All you would have
>to do is save the status vector in go32 and swap in the new process. This
>requires a large amount of programming, ie a procedure to stave the current
>status, a timer to control when processes are switched in and out, etc. etc.
>
>You seem to forget that an OS is not magic, just a piece of software, and that
>just about anything that can be accomplished in an OS can be accomplished
>in a seperate program as well.
>
>						S. Walizer

Lets not confuse fork with multitasking...

Most spawns are are really:

switch(fork()) {
	case parent:
		wait()
	case child:
		play with fds and enviornment
		exec()
}

I had a fork I used for years on Dos on Aztec C...

This will not work if true multitasking is needed (i.e.
concurrent processes).

But probably 95% of the Unix software is really spawn...

The idea is no munging of the source code is needed, and it
becomes sensible to play with the fds and environment in the child...

marty

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019