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
Question 1: (a) Describe what is meant by Client-server Computing? (b) Distinguish between a server process and a client process. (c) What are the basic characteristics o

Determine how Action implementing instruction’s meaning are a actually carried out   Action implementing meaning of instruction are a actually carried out Instruction executio

What are the objectives for a file management system? To meet the data management wants and requirements of the user, which embrace storage of data and the ability to

Define Virtual memory Virtual memory is employed in all major commercial operating systems

Question 1 Explain single Partition Allocation and Multiple Partition Question 2 What is PCB? What useful information is available in PCB? Question 3 Explain Preemptive and No

Conservative GC can be used for languages such as C and C++, which were not explicitly designed for garbage collection. This is a non-copying technique. A conservative garbage coll

Question: (a) As a System administrator, elaborate on how you can manage computer accounts in Active Directory of Windows Server 2008? (b) Explain the following user p

What is preemptive and nonpreemptive scheduling? Under nonpreemptive scheduling once the CPU has been allocated to a process, the process keeps the CPU unless it releases the C

Page Fault Handling conditions like, where the copy on write bit of a page is set and that page is send by more than one process, the Kernel assign new page and copies the conten