| | |
cheeky java program
![]() |
•
•
Join Date: Oct 2004
Posts: 17
Reputation:
Solved Threads: 0
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);
}
}
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);
}
}
>i want to write the program in java language
Then you're using the wrong language.
>The program is a Simulation of Producer-Consumer Problem using Race Condition, using SLEEP/WAKEUP.
Typically when I ask for more detail, I'm looking for something other than a regurgitated version of the original question with an addition that's obvious from looking at the code. You haven't told me anything new, but I'll give you one more try before I plonk you.
Then you're using the wrong language.
>The program is a Simulation of Producer-Consumer Problem using Race Condition, using SLEEP/WAKEUP.
Typically when I ask for more detail, I'm looking for something other than a regurgitated version of the original question with an addition that's obvious from looking at the code. You haven't told me anything new, but I'll give you one more try before I plonk you.
I'm here to prove you wrong.
•
•
Join Date: Oct 2004
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Narue
>i want to write the program in java language
Then you're using the wrong language.
>The program is a Simulation of Producer-Consumer Problem using Race Condition, using SLEEP/WAKEUP.
Typically when I ask for more detail, I'm looking for something other than a regurgitated version of the original question with an addition that's obvious from looking at the code. You haven't told me anything new, but I'll give you one more try before I plonk you.
Any help of coding will be really appreciazted but if not thank you.
![]() |
Similar Threads
- put the Dos 's command into java program? (Java)
- JAVA program help (Student/Grades) (Java)
- Help with a java program home work assignment (Java)
Other Threads in the Java Forum
- Previous Thread: Quality
- Next Thread: can someone help i need to add a subclass
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






