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

Determine the syntax of the assembler directive equ, Determine the syntax o...

Determine the syntax of the assembler directive EQU The following is syntax of the assembler directive EQU: EQU

Describe the purpose of the open and close operations, Q. Describe the pur...

Q. Describe the purpose of the open() and close() operations. Answer: The open() operation notifies the system that the named file is about to become active. The c

Utility programs, Utility Programs: those programs which are not the essen...

Utility Programs: those programs which are not the essential part of operating system. But they provide different utilities / features to the users e.g. MS-DOS : Fdisk, FORMAT, AT

Define a state which is not a fundamental process state, Define a state whi...

Define a state which is not a fundamental process state Answer: Blocked state is not a fundamental process state

What are the operations of a directory, Operations that are to be performed...

Operations that are to be performed on a directory are Search for a file: We are able to find all files whose names match a exact pattern. Create a file: New files requi

Explain segmentation hardware?, Explain segmentation hardware? We defin...

Explain segmentation hardware? We define an completion to map two-dimensional user-defined addresses into one-dimensional physical addresses. This mapping is affected by means

Explain the entry-sequenced file organization, Entry-sequenced file organiz...

Entry-sequenced file organization The records in an entry-sequenced file are store up in the order they are written into the file. New records are for all time appended to

What are the different thread levels?, What are the different thread levels...

What are the different thread levels? There are two broad type of thread implementation: User-Level Threads -- Thread Libraries. Kernel-level Threads -- System Calls.

Explain the fork function, Explain the Fork Function Fork function caus...

Explain the Fork Function Fork function causes a new process to be created. The calling progress is duplicated as an exact copy (called the child process) that differs only in

Micro operation, Ask question maxmum words accepted#

Ask question maxmum words accepted#

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