Semaphores, Operating System

Assignment Help:

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.


Related Discussions:- Semaphores

Error detection, about error detection in operating system and how does it ...

about error detection in operating system and how does it take place?

How can the deadlock be prevented-bankers algorithm, How can the deadlock b...

How can the deadlock be prevented Bankers algorithm : The Resource allocation graph algorithm isn't applicable to a resource allocation system with multiple instances of every

What is multiprogramming, What is Multiprogramming? Multiprogramming is...

What is Multiprogramming? Multiprogramming is the capability of am operating system to support multiple applications running concurrently. Multiprogramming simply means that an

Explain a computing environment, Q. Polling for an I/O completion is able ...

Q. Polling for an I/O completion is able to waste a large number of CPU cycles if the processor iterates a busy-waiting loop several times before the I/O completes. However if the

What are the system components of an operating system, What are the system ...

What are the system components of an operating system and explain them? a) Process management b) Main-memory management c) I/O management d) File management e) Seco

Independent process, what is independent process? distinguished between ind...

what is independent process? distinguished between independent process and co-operating process

Define the windowsnt, Define the WindowsNT WindowsNT provides a two-lev...

Define the WindowsNT WindowsNT provides a two-level approach to resource management: process and thread. The process is the uppermost level and contains most of the application

Define an assembly language, Define an assembly language  Assembly lan...

Define an assembly language  Assembly language stands for a Low level programming language

Difference between system calls and procedure calls, The Most comman differ...

The Most comman difference are given below System calls are heavy. While a procedure call can generally be performed in a few system instructions, a system call needs the c

What is the mfd, What is the MFD? UFD? How are they related? MFD is mas...

What is the MFD? UFD? How are they related? MFD is master-file directory, which points to the UFDs. UFD is user-file directory, which points to each of user's files.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd