Semaphore: A variable or abstract data type used in computer science to control access to a common resource by multiple threads and avoid critical section problems in a concurrent system.
Synchronization primitive: Semaphores are a type of synchronization primitive.
Trivial Semaphore: A plain variable that can be incremented or decremented based on conditions.
Real-World Analogy
Library Study Rooms:
Represents a semaphore where the number of free rooms corresponds to the semaphore count.
Access to rooms is controlled by decrementing the semaphore value.
When a room is freed, the semaphore value is incremented.