Semaphores, Operating System

Synchronization can be achieved by means other than locks and condition variables. One alternative is semaphores. A semaphore is used to regulate traf?c in a critical section. A semaphore is implemented as a non-negative integer counter with atomic increment and decrement operations, up() and down(), respectively. Whenever the decrement operation would make the counter negative, the semaphore blocks instead.  down(sem): tries to decrease the counter by one; if the counter is zero, blocks until the counter is greater than zero. down() is analogous to wait().

 up(sem): increments the counter; wakes up one waiting process. up() is analogous to sig- nal().

Semaphores in computer science were introduced by the Dutch computer scientist Edsger Dijkstra, and so down() is sometimes called P(), from the Dutch for proberen, roughly "try [to decrement]", and up() is sometimes called V(), from the Dutch for verhogen, roughly "increment". Notice that we can use semaphores to impose both mutual exclusion and ordering constraints. In some sense, semaphores, with two operations, are more elegant than monitors, with ?ve operations (namely, lock(), unlock(), wait(), signal(), and broadcast()).

Some people, however, ?nd semaphores less intuitive thanmonitors. There is also an important difference between semaphores and signals: signals have no memory, whereas semaphores do have memory.

Posted Date: 3/12/2013 5:22:08 AM | Location : United States







Related Discussions:- Semaphores, Assignment Help, Ask Question on Semaphores, Get Answer, Expert's Help, Semaphores Discussions

Write discussion on Semaphores
Your posts are moderated
Related Questions

Ask question #Minimum 100 difference between bounded and unbounded buffer words accepted#

What does Verification represent? Verification shows the set of activities that are carried out to confirm that the software correctly executes the specific functionality.

What is a file? A named collection of related data explained by the creator, recorded on secondary storage.

Q. Explain Message passing among systems? Communications- Message passing among systems requires messages to be turned into packets of information and sent to the network contr

How does a program execution take place in multiprogramming? While the processor is dealing with a number of programs, the sequence with which programs are implemented will de


Determine a parser which is a variant of top-down parsing without backtracking Recursive Descend parser is a variant of top-down parsing without backtracking.

Define UNIX device driver The UNIX device driver is structured into two halves called top half and bottom half

Multithreading - Operating systems that permit different parts of a software program to run concurrently. Operating systems that would come into this category are: Linux UNI