Sunday, October 23, 2016

Semaphore

Tags

A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each acquire() blocks if necessary until a permit is available, and then takes it. Each release() adds a permit, potentially releasing a blocking acquirer. However, no actual permit objects are used; the Semaphore just keeps a count of the number available and acts accordingly.

Producer Consumer using semaphore
Producer ConsumerAp using semaphore


EmoticonEmoticon