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
Briefly explain about file system implementation? Several on-disk and in-memory structures are used to execute a file system. On disk, the file system may have information abou

Explain Busy Waiting Semaphores Weak, Busy-wait Semaphores a) The simplest way to implement semaphores. b) Useful while critical sections last for a short time, or we com

Question: a) Windows Server 2003 has brought great enhancements the Server System as compared to the previous version. Write down short notes on the below listed enhancements.

Suppose your process starts up, and allocates some memory with malloc(). The allocator will then give part of a memory page to your process. The OS then updates the corresponding p

Explain about threading issues? The fork and exec system calls In a multithreaded program of few UNIX systems have chosen to have two versions of fork, one that duplicates e

It uses unix commands such as forks and pipe .I need solution to this project

Explain Load Balancing Client Server Components When migration functionality from the client - only model to the client - server model, care must be taken not over-or underutil

Synchronization serves two purposes: 1) to ensure safety for updates on shared data (e.g. to avoid races conditions), and 2) to coordinate and order actions taken by threads (e.g.

Page fault is a trap to the software gained by the hardware when a process accesses a page that is goes in the virtual address space, but not added in physical memory. In the har

Define entry section and exit section. The critical section problem is to design a protocol that the processes can use to cooperate. Every process must request permission  to e