home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 12860 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  2.1 KB

  1. Path: sparky!uunet!utcsri!torn!cunews!revcan!sidus!atronx.OCUnix.On.Ca!qpoint!dej
  2. From: dej@qpoint.ocunix.on.ca (David Jones)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re:  fork() for AmigaDOS?
  5. Distribution: world
  6. Message-ID: <dej.01dt@qpoint.ocunix.on.ca>
  7. References:  <1992Aug26.010450.18412@galileo.cc.rochester.edu> <paulk.1a06@terapin.com>
  8. Date: 28 Aug 92 20:38:43 EST
  9. Organization: Dejital Software
  10. Lines: 33
  11.  
  12. In article <paulk.1a06@terapin.com> paulk@terapin.com (Paul Kienitz) writes:
  13. >> Is there a AmigaDOS fork() that works like UNIX fork()?
  14.  
  15. Although CreateNewProc() can be used to create a new process, there is
  16. a fundamental difference in OS design between AmigaOS and Unix which
  17. can seriously affect the way a Unix programmer designs an Amiga program.
  18.  
  19. Under Unix, fork() causes an exact copy of the currently executing
  20. process's memory image to be made.  The resulting parent and child
  21. processes do not share any common memory (unless they deliberately
  22. set up a shared memory segment).  Also, file handles are duplicated
  23. so that both parent and child have open whatever was open just before
  24. the fork() call.  When setting up pipes, usually parent and child
  25. close opposite ends of a pipe so that data transfer is unidirectional.
  26.  
  27. Under AmigaOS, there is no memory protection, so separate core images
  28. are impossible (for now).  Also, no system resources are duplicated,
  29. so closing a file in one process will cause the other process's file
  30. to be closed as well.  (Not the case in Unix).
  31.  
  32. An example of this difference in design can be seen in the gnutar
  33. source code.  Under Unix, gnutar forks twice if compressed archiving
  34. is requested: a reader process, a writer process, and compress.
  35. Under AmigaOS, gnutar cannot compress.  Reason: although AmigaOS can
  36. spawn child processes, the differences in pipe handling required
  37. between AmigaOS and Unix would have made the program too difficult
  38. to port, so compression was not supported on the Amiga.
  39.  
  40. --
  41.  David Jones, 6730 Tooney Drive, Orleans, Ontario K1C 6R4 CANADA
  42.        email: dej@qpoint.ocunix.on.ca    Fido: 1:163/109.8
  43.  AMIGA: Advanced Multimedia with Interactive Graphics and Audio
  44.  
  45.