First attempt on implementation of counting semaphores