This is the pizza making problem which is just another Semaphore problem.