New course! Every coder should learn Generative AI!
Try a free lesson+ 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