[comp.lang.c] Child processes in Mess-Dos

sarathy@gpu.utcs.utoronto.ca (Rajiv Sarathy) (09/29/90)

Since I posted the original article to both c.l.c and c.o.m.p, I've posted
the summary to both also.  Henceforth, I'll only use the latter, as should
anyone else asking about MS-DOS related things, IMHO.  Flames to /dev/null.

A couple of weeks ago, I posted an article asking for opinions on using
various techniques to reduce the amount of code sitting in memory from a
very large application.

Some of the options I suggested were:

	a) Overlays
	b) using MS C's "spawn"
	c) using MS C's "exec"
	d) using MS C's "system"

I also gave some obvious pros and cons of each.  Several people responded.
I've decided that my initial hunch, using overlays, is the best choice
despite its drawbacks (time to load/unload, MS Linker's inability to optimize
modules automatically, inability to use some functions in more than one
module, etc.).

Some people suggested using Borland's VROOM (included with C++).  As
toma@tekgvs.LABS.TEK.COM (Tom Almy) posted, VROOM will not work with MS
OBJs.  (This according to a friend who sells Borland products but isn't a
programmer ;-)

Others were under the impression that spawn and exec load an additional
copy of COMMAND.COM.  I didn't test to see if this is true, but I doubt it.
The manual makes no mention of it, and MS Tech Support in Canada didn't 
think so either.  We were both under the assumption that the new process is
just loaded into higher memory in the case of spawn (with P_WAIT), and
loaded on top of the caller in the case of spawn (with P_OVERLAY), and
exec.  The system call, however, does execute another command interpretor.

Thanks for everyone's help.

-- 

 Rajiv Partha Sarathy         _  _ /@\    INTERNET sarathy@gpu.utcs.utoronto.ca
 ................ooooooooOOOO(_)(_)\@/      BITNET sarathy@utorgpu.bitnet
 University Of Toronto Computing Services     UUCP sarathy@utgpu.uucp

2113av@gmuvax2.gmu.edu (John Porter) (10/04/90)

In article <1990Sep28.234836.17868@gpu.utcs.utoronto.ca> sarathy@gpu.utcs.utoronto.ca (Rajiv Sarathy) writes:
>Others were under the impression that spawn and exec load an additional
>copy of COMMAND.COM.  I didn't test to see if this is true, but I doubt it.


The MS-DOS programming references are rather explicit on this point.
I have written programs to test these hypotheses, and it is quite true
(at least for ver.3.30) that spawn and exec do NOT load COMMAND.COM.
Both of these system calls are handled by a load/exec routine located in
the resident portion of DOS.

-- john.porter