Semaphores are a concept to synchronize parallel task.
The basic idea of semaphores is to have a shared counter for all parallel task. The counter can be decreased with the enter or enterNB method and increased with the leave operation. The operations are primitive, i.e. can only be performed by one process at one time and can not be interrupted. When the counter has the value 0, a enter operation will block the calling process. The process can only be released with a leave call of another process.