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