home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6829 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: sparky.navsea.navy.mil!matuli_a
  2. From: matuli_a@marlin.navsea.navy.mil (Alex Matulich 03T1 602-6691)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Messages vs. Semaphores for external clocking
  5. Date: 3 Apr 1996 14:48:41 GMT
  6. Organization: Naval Sea Systems Command Code 03T1
  7. Message-ID: <4ju349$r1e@sparky.navsea.navy.mil>
  8. NNTP-Posting-Host: marlin.navsea.navy.mil
  9.  
  10. I am wondering what is the most efficient way for one task to make data
  11. available to another task.  I can do this by passing messages, or by
  12. setting up a semaphore to provide a common area of memory accessible by
  13. both tasks.
  14.  
  15. My question is, what has the least overhead?  With message passing there
  16. is some Exec overhead in handling the MessagePort, plus the application
  17. receiving the message has to reply to it.  With semaphores there's some
  18. overhead associated with locking and unlocking the semaphore.
  19.  
  20. My application:  I will have two tasks running.  The secondary task runs
  21. in the background, continually acquring data from a device connected to
  22. the serial port or game port, and converting this data to time units.
  23. The time units number will be stored either in a Message or Semaphore.
  24. Then my primary application, running at the same time, will be able to
  25. access this time number any time it needs to.
  26.  
  27. (In case you're wondering, the reason I can't use regular internal timers
  28. is because my program must be synced to this external device which can
  29. start and stop its clock at will).
  30.  
  31. Can anybody give me some friendly advice?  Thanks.
  32.  
  33. -- 
  34.                                            /|
  35. Alex Matulich                      __.  __=#||  ___   _o--
  36. matuli_a@marlin.navsea.navy.mil ____##_/_____|==###===###____
  37.                                 \____________________________\
  38.