Semaphores signal the beginning and ending of an operation and provide mutually exclusive ownership of resources. Typically, semaphores are used to prevent more than one process or thread within a process from accessing a resource, such as shared memory, at the same time.
Semaphores are defined by the system and reside in an internal memory buffer. They are divided into three types, according to the functionality they provide: