A semaphore is a special variable which is used for coordinating activities in which multiple processes compete for the same resource. A process needing the resource will first check the semaphore's value to determine if it can use the resource or if it must wait and try again. When a process can use the resource, it will change the semaphore's value to flag other semaphore users to wait.
A data structure that is used for coordination of concurrently running tasks. See mutex