HP OpenVMS Systems

ask the wizard
Content starts here

What is a Semaphore?

» close window

The Question is:

What is a semaphore?

The Answer is :

  A semaphore is a signaling mechanism; a coordination mechanism.
  In the context of railroad signaling, you will want to investigate
  discussions (elsenetwork) of "block signals" -- a "block signal"
  is a common synonym for semaphore, as used by a railroad.
  In the context of an operating system, semaphores are constructs
  used to protect critical shared code paths and critical shared data
  structures within an application or an operating system, much like
  a "block signal" is used to prevent a train from entering a discrete
  section of track -- these sections of track are known as blocks --
  that currently contains another train or some other impediment to a
  safe rail journey.  Without mechanisms such as semaphores, two
  applications could conceivably modify the same shared data entirely
  in parallel, and this can potentially result in data corruptions.
  Or two trains could potentially collide within a block of track.
  Within OpenVMS, the DECthreads environment specifically provides a
  set of semaphore calls for application use.  Within OpenVMS, many
  mechanisms directly or indirectly provide semaphore capabilities --
  the OpenVMS distributed lock manager is a salient example of an
  OpenVMS mechanism directly useful as a semaphore.

answer written or last revised on ( 17-JUL-2001 )

» close window