home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / os2 / advocacy / 3359 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.2 KB

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