Implementations of semaphores