TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Darin McBride
from: Jonathan de Boyne Pollard
date: 1996-07-28 22:04:32
subject: semaphore

DM>
  > DL> The semaphores are designed for threads; I'm not sure if you can use
  > DL> them for inter-process communications or not, just inter-thread
  > DL> communications.
  >
  > Semaphores are designed for inter-process, not inter-
  > thread.  Since they are globally available, threads may use
  > them, but just as often, critical sections may be used to a
  > greater efficiency as they have lower overhead (if they are
  > the same as the WinNT versions of these functions, which is
  > likely considering their common base).
DM>

  Wrong on two counts.

  Semaphores are designed for inter-thread communication.  This works
  equally well between threads of different processes as it does for
  threads of the same process.  The only consideration for the former is
  that the semaphore be named (otherwise the second process cannot locate
  the semaphore).

  Secondly, critical sections are a far worse option than semaphores, even
  when used within a single process.  Critical sections disable *all*
  other threads in the same process.  It is a terrible mistake to use
  critical sections as a lazy man's mutex, since critical sections will
  affect *all* threads in your process, whatever they are doing at the
  time, even if they aren't involved in the contention for the mutex at
  all.

  > JdeBP <
___
 X MegaMail 2.10 #0:

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 440/4 141/209 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.