Question: 4. Read the producer-consumer problem with bounded buffer. In the following code, a) when in = 0 and out = 0, what will happen? Please
4. Read the producer-consumer problem with bounded buffer. In the following code, a) when in = 0 and out = 0, what will happen? Please explain. (10 points) b) when in = 9 and out = 0, what will happen? Please explain. (10 points) #define BUFFER_SIZE 10 typedef struct } item; item buffer(BUFFER_SIZE]; int in = 0; int out = 0; item next_produced: while (true) ** produce an item in next produced while (in +19 BUFFER SIZEoud do nothing buffer[in] next produced, in (in - 1) % BUFFER SIZE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
