home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
- From: dic5340@hertz.njit.edu (David Charlap)
- Newsgroups: comp.os.os2.advocacy
- Subject: Re: nt, an assessment
- Message-ID: <1992Jul29.145429.4206@njitgw.njit.edu>
- Date: 29 Jul 92 14:54:29 GMT
- References: <1992Jul27.2712.2901@dosgate> <-159819993@hpopd.pwd.hp.com>
- Sender: news@njit.edu
- Organization: New Jersey Institute of Technology, Newark, N.J.
- Lines: 35
- Nntp-Posting-Host: hertz.njit.edu
-
- In article <-159819993@hpopd.pwd.hp.com> yuk@hpopd.pwd.hp.com (Yuk Lun Chan) writes:
- >Normally, one can port fork() into OS/2 API if the purpose is to start up a
- >new program (exec() after fork()) or a small procedure (can use DosCreateThread
- >?). But There are two problems can't be solved easily. 1. Initialised the
- >main data area and then fork a number of child (The child runs the main
- >routine). 2. Initialised, print out message, command line checking etc and
- >then fork a child, terminate the parant, i.e. running in background.
-
- You'd need to figure out what the program was doing in each particular
- case and write special code for it.
-
- Case 1 would be very difficult - you'd probably have to replicate some
- code unless both threads branched to a common procedure entry point
- immediately after the "fork". As for initialized data area, you'd
- have to make all data non-static. This is done automatically by IBM
- 370 C compilers (to make code re-entrant and re-useable), but I think
- you'd have to do it manually under OS/2.
-
- Case 2 would have to be done with a procedure. You'd create a thread
- which would print out the message and do parameter checking, etc, and
- then start the new process and terminate itself.
-
- In general, it's probably easier to restructure the code around the
- fork() to use OS/2 API's.
-
- Note that new Unix systems (SVR4? can anyone confirm or deny?) have a
- spawn() operator which does the fork/exec procedure for launching
- processes in one step (like DosCreateProcess). This would be trivial
- to port.
-
- --
- |) David Charlap "I don't even represent myself
- /|_ dic5340@hertz.njit.edu sometimes so NJIT is right out!.
- ((|,)
- ~|~ Hi! I am a .signature virus, copy me into your .signature file.
-