1. Binary :- Binary semaphore works on two values '0' and '1' . It acts like a lock that can be acquired (1) and released (0).
Binary semaphore are used as mutual exclusion lock to ensure that only one process access a critical section at any given time
2. Counting Semaphore: - A counting semaphore can have a value grater then one and it is used for control access of resource that has a limited instances
A counting semaphores are used when a resource can be used by more then one process at the same time but there is a limit in access concurrently
Definition: A binary semaphore is a semaphore with only two values: 0 and 1. It acts like a lock that can be either acquired (1) or released (0).
Usage: Binary semaphores are often used as mutexes (mutual exclusion locks) to ensure that only one process or thread accesses a critical section at any given time.
2. Counting Semaphore
Definition: A counting semaphore can have a value greater than one, and it is used to control access to a resource that has a limited number of instances.
Usage: Counting semaphores are used when a resource can be used by more than one process or thread at the same time, but there is a limit on how many can access it concurrently