...

/

Extending The Solution for Multiple Producers And Consumers

Extending The Solution for Multiple Producers And Consumers

Let's build on the solution from the previous lesson to handle the case of more than one producer and consumer.

Let us now imagine that MAX is greater than 1 (say MAX=10). For this example, let us assume that there are multiple producers and multiple consumers. We now have a problem: a race condition. Do you see where it occurs? (take some time and look for it in the code in the previous lesson) If you can’t see it, here’s a hint: look more closely at the put() and get() code.

OK, let’s understand the issue. Imagine two producers (PaP_a ...

Access this course and 1400+ top-rated courses and projects.