pseudo code for producer-consumer(semaphore)