A semaphore is an abstract data type managed by the OS to synchronize access by multiple threads to shared resources and data. It consists of an internal variable that identifies the amount of concurrent access to a resource with which it is associated.