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
How long should a chkdsk r take?
How do I search for a pattern in vi?
Explain about local and global page replacements?
What is RR scheduling algorithm?
What are the benefits and losses of placing the functionality in a device controller rather than in placing it in the kernel?
What is LiveLock?
Can you please explain the difference between load-time dynamic linking and run-time dynamic linking?
What is an operating system on a computer?
What is the programs x86 folder?
What is the difference between process and program?
Is it ok to interrupt chkdsk?
Suppose if we have a variable 'I' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
Is 100 cpu usage bad?
How much ram do I need?
What is dedicated processor assignment in operating system (os)?