for a programming assignment I have been asked to implement a solution to the Dining Philosopher problem. I must do so in two ways:
- Use the wait() and notifyAll() mechanism
- Using an existing concurrent data structure provided in the Java API
I have already complete the first implementation. Which concurrent data structure is my professor talking about for step two? I don’t remember her mentioning anything. I don’t need any source code, just a pointer in the right direction.
You might want to look at the java.util.concurrent Javadoc page to get some ideas. These are not the only concurrent data structures (some of the java.util data structures also have built-in concurrency support) but this is a good starting point.
Collections.synchronizedListis not what I would call ‘an existing concurrent data structure’ — it is a wrapper for data structures that do not support concurrency.