using binary and counting semaphores for consumer/producer problem