Binary semaphore acquisition and release by another thread

In the case of the binary semaphore, it’s not explained what happens if another thread tries to acquire or release a semaphore whose singular permit is already acquired by different thread.

Type your question above this line.


Hi @Christopher_Chan
So binary semaphore has only two states of 0 & 1. 0 means blocked, and 1 means its permit is available. When one thread acquires the permit, the state of the semaphore automatically changes to 0. If another thread tries to acquire the permit during this phase, it will get blocked or added to the waitlist. After the first thread releases the permit, thread two will line up in the ready queue and acquire the permit.