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

What methods are used to monitor intrusion detection, Question : a) Wh...

Question : a) What do you understand by a Directory Structure? Support your answer with a diagram. b) Give an example how Access Lists and Groups are arranged to mode of

What is a dispatcher, What is a Dispatcher? The dispatcher is the modul...

What is a Dispatcher? The dispatcher is the module that gives control of the CPU to the process selected by the short- term scheduler. This function includes: Switching

Identifying parallelism, Identifying parallelism A formal way to identi...

Identifying parallelism A formal way to identify parallelism in an activity is to draw a task dependence graph in a directed graph in which each vertex represents a task to

Analysis of Pseudocode Sempahore Solution, Gopher Gallery consists of a sho...

Gopher Gallery consists of a shopping mall and a cart ride that covers the 150 acre habitat. There are m visitors and n single-person vehicles. Visitors stroll around the mall at

Network operating system, what is network operating? explain about it desig...

what is network operating? explain about it design issues?

Explain what is file structure, Problem 1. List out the conditions that...

Problem 1. List out the conditions that result in Deadlock situations. Illustrate deadlock situation with a simple graphical notation Listing conditions for deadlock occu

What is directory, What is Directory? The device directory or simply ca...

What is Directory? The device directory or simply called as directory records information-such as name, location, size, and type  for all files on that certain partition. The d

Define the dosexit function used in the os/2, Define the DosExit Function u...

Define the DosExit Function used in the OS/2 DosExit(action, resultCode)  DosExit function is to be called when a thread or process is finished executing. If EXIT_THREAD is

Explain combined ult/klt approaches, COMBINED ULT/KLT APPROACHES Idea i...

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

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