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. A Burroughs B7000/B6000 MCP file is able to be tagged as sensitive data. When such a file is removed its storage area is overwritten by some random bits. For what reason would

Q.  When virtual memory is executed in a computing system there are convinced costs associated with the technique and certain benefits. List the costs as well as the benefits. Is i

A friend has promised to log in at a particular time. However, he needs to be contacted as soon as he logs in. The shell script checks after every minute whether he has logged in o

Facilities of a Debug Monitor Facilities of a debug monitor are like this: Setting breakpoints in the program Initiating a debug conversation while control reaches

Processes and Programs Process is a dynamic entity which is a program in execution. A process is a sequence of information executions. Process exists in a limited span of t

what is deadlock

i need the job to be done within 3 days

Q. In the IBM/370 memory protection is offered through the use of keys. A key is a 4-bit quantity every 2K block of memory has a key (the storage key) associated with it. The CPU

Cold Backup: It is copying the three groups of files when the object is shut down. This is a straight file copy, generally from the storage disk directly to tape. You must end th

Q. Discuss the advantages as well as disadvantages of caching name translations for computers located in remote domains. Answer: There is a performance benefit to caching nam