Question: Using Java make a console based program that will create two threds, one producer one consumer. producer must open input file and copy values into

Using Java make a console based program that will create two threds, one producer one consumer. producer must open input file and copy values into a circular bufer. Consumer must open an output file and repetedly copy values from the same circular buffer. Both use a random number of bytes betwen 1 and including n taht must be copied each iteration. n is set each time by the user. if producer unable to write to the buffer because it is full or if consumer is unable to read from buffer because not enough unead items, then it should go to following iteration. Only exception is when producer has read entire file, then consumer does not have to continue generatin random numbers until it gets an exact hit, instead it must write the rest of the buffer to complete copy. When done running the output should be the same as input file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!