Fast, reliable and serialized algorythm for semaphores.