The semaphore is an abstract data store that is used to control resource accesses across the various threads of execution or across different processes.
There are two types of semaphores:
• The binary semaphore which can take only 0,1 values. (used when there is contention for a single resource entity)
• The counting semaphore which can take incremental values to certain limit (used when number of resources is limited).