OS-Semaphore in Unix

Unix provides facilities for the creation and handling semaphores.

Unix employs a fairly elaborate generalized system of data structures and functions and no simply direct equivalents of the wait and signal operations are provided.
  •  Semget functions call which created an array of semaphores.
  •  The semget call specifies the number of semaphores required, a unique key value and some access and control information.
  •  The semctrl provides a range of semaphore maintenance services such as examining the value of a semaphore, removing & initializing the semaphore.
  •  The processing of the semaphore is carried out by the semop function call.
  •  Data structure sembuf which consists of sem-num, sem-op & sem-flg is used.
  •  Sem-num contains the array index of the semaphore being refrenced.
  •  Sem-op contains the integer values to modify the semaphore.
  •  Sem-flg is used to quality the operation.
Share this article :
 
Copyright © 2012. Best Online Tutorials | Source codes | Programming Languages - All Rights Reserved