Ok, so a producer consumer problem runs producer so long as there is room left (<N) 'on the shelf' and consumes so long as there is a product to consume.
So our previous programs produced a queue of threads and switched between the elements in the queue continuously. Since the program executed sequentially, the various threads cannot execute out of order or create run conditions as they could in real life.
So, to create producer consumer building on what we have, is the Queue we have the 'shelf'? Do we set a maximum for it? (say 1)
Then we create 2 producer threads, and 2 consumer threads, and add them if there is room left, remove them if there is one running? To accurately test the use of semaphores, we'd need to add more than the queue maximum and then the P() method would not add to the RunQ, but instead add the new thread to a SemQ. V() would remove a thread from the RunQ, and release any that are in the SemQ?
Is this what we're trying to implement? Or am I completely off base?
Thanks,
Brian G