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
Q. The instance of handshaking used 2 bits: a busy bit as well as a command-ready bit. Is it probable to implement this handshaking with only 1 bit? If it is illustrate the protoc

Determine the syntax of the assembler directive EQU The following is syntax of the assembler directive EQU: EQU

Q. Describe the purpose of the open() and close() operations. Answer: The open() operation notifies the system that the named file is about to become active. The c

Define seek time and latency time. The time taken by the head to move to the appropriate cylinder or track is known as seek time. Once the head is at right track, it must wait

COMBINED ULT/KLT APPROACHES Idea is to merge the best of both approaches Solaris is an illustration of an OS that combines both ULT and KLT  Thread creation complete i

MEMORY MANAGEMENT USING LINK LISTS The first one is for showing it is process or hole, second is for starting address and third is for length of the process and last is a point

As we already know, threadsmust ensure consistency; otherwise, race conditions (non-deterministic results) might happen. Now consider the "too much milk problem": two people share

Briefly discuss on page replacement? Page replacement approach is fixed as follows. If no frame is free, we search one that is not presently being used and free it. We can fre

linked allocation using i node

What makes a Just-in-Time inventory system differ from a traditional inventory system?