What is Semaphore?

What is Semaphore?
A. Grant more than one thread access to a shared resource at the same time
B. Useful when a collection of resources is being synchronized
C. Make use of a counter to control access to a shared resource
D. All of the mentioned
 
Answer: d
Explanation: A semaphore is similar to a mutex except that it can grant more than one thread access to a shared resource at the same time. Thus, the semaphore is useful when a collection of resources is being synchronized. A semaphore controls access to a shared resource through the use of a counter. If the counter is greater than zero, then access is allowed. If it is zero, access is denied.
 

Tìm kiếm

Back
Top