Question: Consider the following multi - threaded pseudocode to send messages to and receive messages from a buffer with size 3 ( i . e .

Consider the following multi-threaded pseudocode to send messages to and receive
messages from a buffer with size 3(i.e., there are 3 slots for messages in the buffer). Note
that the buffer functions are not thread-safe.lock(&channel->mutex); unlock(&channel->mutex); lock(&channel->mutex);data = buffer_remove(channel->buffer);unlock(&channel->mutex);}
void send_msg(channel_t* channel, void* data){while (buffer_full(channel->buffer)){ cond_wait(&channel->cv2, &channel->mutex);}cond_signal(&channel->cv1);}Where are the bug(s) if any exist? Select any lines that must be changed and/or removed.
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23
Line 24
No bugs
 Consider the following multi-threaded pseudocode to send messages to and receive

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!