What is a binary semaphore? What is its use?
Answer Posted / ashaa
The semaphore discussed previously is called a counting sempahore. Another kind of semaphore is the binary semaphore; This is exactly like a counting semaphore except for the following:
the semaphore value is restricted to 0 and 1.
P succeeds only when the semaphore value is 1.
V does not change the semaphore value when it is 1. (Thus successive Vs are lost.)
Binary semaphores are sometimes easier to implement. than counting semaphores. We will not describe implementations of binary semaphores in terms of low-level or OS constructs (these would be similar to the implementations of counting semaphores). Instead we show how counting semaphores can be implemented by binary semaphores, which demonstrates that binary sempahores are as powerful as counting semaphores.
Convention: Unless otherwise mentioned, a semaphore is to be interpreted as a counting semaphore.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What are threads in OS?
How many stages are there in chkdsk?
Explain how a copying garbage collector works. How can it be implemented using semispaces?
what is the memory wall problem?
Describe Banker’s algorithm
Explain a drawback of mvt?
What is inaddr_any?
What is the purpose of port forwarding?
What are the three conditions that must be present for deadlock to be possible?
Will chkdsk repair corrupt files?
What are the two main types of files?
What is ecc in reference to ram?
Difference between short term, long term and medium term scheduler.
What are the different job scheduling in operating systems?
How can the speed of interrupt driven input output systems be improved?