Unsynchronized Producer Consumer Problem
807606Apr 1 2007 — edited Apr 2 2007Hi I would like some help implementing an unsynchronized producer consumer with an unbounded queue (implemented using an ArrayList) I have both the producer and consumer sleeping for random amount of time (producer wakes up faster). The problem is that sometimes the producer never gives the consumer a chance to run.
Note I have a notify after I add stuff to the ArrayList. I dont know whether its my choice of collection object or the fact that I have not defined a wait for the producer.
I don't know whether I have explained my problem clearly so feel free to ask some questions. Thanks