In this tutorial, we will be discussing a Semaphore and its types ie. Binary, Mutex, Counting.
Later we will see each semaphore in detail with its pros and cons. Also, we will be looking into priority inversion and priority inheritance.

What is a Semaphore?

Semaphores are a technique for synchronizing two/more task competing for the same resources. When a task wants to use a resource, it requests for the semaphore and will be granted if the semaphore is available. If the semaphore is not available then the requesting task will go to blocked state till the semaphore becomes free.