Wait(mutex) and Signal(mutex) in Semaphore ?? | Sololearn: Learn to code for FREE!

+3

Wait(mutex) and Signal(mutex) in Semaphore ??

6/11/2018 6:11:49 AM

HUNT

1 Answer

New Answer

+2

Yes. There are many cases we use wait() and signal() in Semaphore. -> Binary Semaphore: You allow only one thread to access a resource at a time. -> Making sure: resource_access <= MAX: Suppose we dont want to open N number of files ->Shared buffer: On a full buffer, we cant add resource. On empty buffer, we cant use resource. In both case we need signaling of conditions and waiting mechanism