home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 18041 < prev    next >
Encoding:
Text File  |  1993-01-02  |  2.3 KB  |  55 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!jato!jdickson
  3. From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
  4. Subject: Re: IPC and shared memory
  5. Message-ID: <1993Jan2.081756.21863@jato.jpl.nasa.gov>
  6. Organization: Jet Propulsion Laboratory
  7. References: <Jean-Guy_Speton.056u@tvbbs.wimsey.bc.ca> <paulk.317w@terapin.com>
  8. Date: Sat, 2 Jan 1993 08:17:56 GMT
  9. Lines: 44
  10.  
  11. In article <paulk.317w@terapin.com> paulk@terapin.com (Paul Kienitz) writes:
  12. >> I am looking for information on inter-process communications (IPC)
  13. >> and shared memory functions.  Do the Amiga libraries have any
  14. >> functions along these lines?
  15. >Sure, there's PutMsg() eh.
  16. >> The reason I'm asking is I intend on writing a multi-line door, but
  17. >> have questions as to how the different processes of the door will
  18. >> communicate with one another.  I have a few ideas in mind, but they
  19. >> all seem as if they will become extremely slow and inefficient with
  20. >> more than a few lines.
  21. >Last time I messed around with a multiplayer game on a mainframe, the
  22. >way it was done, which worked pretty well, was to have an area of
  23. >memory that all the processes knew about, accessed through a locking
  24. >mechanism to protect crucial sections of code.  The way to do this
  25. >under AmigaDOS is with a named SignalSemaphore.  Tasks can arbitrate
  26. >access to the data by taking locks on the semaphore, and the process
  27. >of finding the semaphore by name allows the different tasks to all
  28. >get pointers to the same piece of memory, which the semaphore happens
  29. >to be the first item in.
  30.  
  31. Sure, a signal semaphore is the way to go, but for efficiency reasons I don't
  32. think named ones are a good idea. You see to guard against the slight chance
  33. the semaphore could go away whilest trying to find it via FindSemaphore - you
  34. are supposed to protect the operation with the Forbid/Permit pair. Not only 
  35. do you pull the plug on multitasking, but IMHO FindSemaphore is a waste of
  36. time if your usage of it is purely for the convenience of knowing it by name.
  37. I suggest simply making the signal semaphore globally known or just to the
  38. tasks/processes that wish to use it and forgo the FindSemaphore bit all
  39. together. Of course, this may not be an option. Just know that there is more
  40. than one.
  41.  
  42. Jeff
  43.  
  44.  
  45.  
  46.  
  47.  The way I
  48. do it is to make the signal semaphore known to every task/process that wishes
  49. to use it. This saves 
  50.  
  51.  
  52.