Should You Use a Semaphore Instead of a Mutex

 A semaphore can be used instead of a mutex if none of the tasks competing for the shared resource have deadlines to be satisfied.

 However, if there are deadlines to meet, you should use a mutex prior to accessing shared resources. Semaphores are subject to unbounded priority inversions, while mutex are not.