Daily Term: Semaphore
Semaphore
A Semaphore is a synchronization mechanism that controls access to a shared resource by maintaining a counter. Threads can acquire the semaphore if the counter is greater than zero, decrementing it, and release it to increment the counter. For example, a semaphore with a count of 3 might allow up to 3 threads to access a resource simultaneously. Semaphores are more flexible than mutexes for managing multiple accesses but can still lead to issues like starvation.
Date: 2025-08-13