hia, the below program is a Simulation of Producer-Consumer Problem using Race Condition.Please can anyone help me to finish this program in java language.Thanks a lot
lux melxxx
Producer/Consumer code
int BUFFER_SIZE = 100;
int count = 0;
void producer(void) {
int item;
while(TRUE) {
produce_item(&item);
if(count == BUFFER_SIZE) sleep ();
enter_item(item);
count++;
if(count == 1) wakeup(consumer);
}
}
void consumer(void) {
int item;
while(TRUE) {
if(count == 0) sleep ();
remove_item(&item);
count--;
if(count == BUFFER_SIZE - 1) wakeup(producer);
consume_item(&item);
}
}