Question: Create a process that has producer thread and a consumer thread. Both threads access a finite buffer of MAX_LENGTH and the items in the buffer
Create a process that has producer thread and a consumer thread. Both threads access a finite buffer of MAX_LENGTH and the items in the buffer are integers. By the time the program terminates all produced items should be consumed, in the right order (FIFO), and the final buffer should be empty.
Your program should:
a. Read an input from the user to specify the number of items the producer should produce.
b. Show when each thread is running the item number that was either produced or consumed and the count of how many items are left in the buffer.
c. The final count of items of the buffer should be zero.
Step by Step Solution
3.40 Rating (159 Votes )
There are 3 Steps involved in it
Heres an example of a program that has a producer thread and a consumer thread both accessing a finite buffer of MAXLENGTH The items in the buffer are ... View full answer
Get step-by-step solutions from verified subject matter experts
