When to use a semaphore and when to use a conditional variable?
When to use a semaphore and when to use a conditional variable?
semaphore need to know the count upfront for initialization. There is no such requirement for condition variables.
The the mutex and conditional variables are inherited from semaphore.
mutex, the semaphore uses two states: 0, 1condition variables the semaphore uses counter.They are like syntactic sugar