what's the difference between a binary semophore and a mutex?

1. A semaphore post (or basically unlock) can be performed by a different thread. However, in the case of mutex, it should be unlocked only by the same thread.

2. A semaphore post is always remembered. In other words, a producer thread can signal an unlock even when no consumer thread is waiting for data. In this case, when a consumer thread comes up and tries to block on a call to sem_wait (or locking), it can proceed further and gain control of the semaphore (which had been signalled before by the producer thread). This does not happen with a mutex - any unlock from another thread is lost.