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
what is hashed page tables & explain of there work & figure

LINUX VS WINDOWS I/O MANAGEMENT

Describe the file system architecture. File System Architecture contains the subsequent components:- Device Driver 1 Device Driver 2 Device Driver 3 Basic fi

What are the functions of virtual file system (VFS)? a. It separates file-system-generic operations from their execution defining a clean VFS interface. It permits transparent

Explain internal fragmentation The Internal fragmentation signifies to the result of reserving a piece of space without ever intending to use it. This space is wasted that this

What is degree of multiprogramming ? Degree of multiprogramming signifies the number of processes in memory. If the degree of Multiprogramming is steady after that the average

Define ‘LRU’ page replacement policy LRU is Least Recently Used page replacement policy.

demonstrate ergonomics

Linked list allocation: At this time the blocks are stored using linked lists. The block size require not be the same. Thus internal fragmentation is avoided. Consider

draw a state diagram showing the transissions of a process from creation to termination