Question: The following is an incorrect solution to the bounded buffer problem (making use of a circular buffer). We use C-like syntax. The .wait and .signal

The following is an incorrect solution to the bounded buffer problem (making use of a circular buffer). We use C-like syntax. The .wait and .signal are operations on condition variables. The get() entryprocedure is correct, all the errors are in the put() entryprocedure. In the space given to the right write the correct put() entryprocedure. It should be no more than 5-6 lines of code. You are not allowed to introduce additional ordinary variables or additional condition variables.The following is an incorrect solution to the bounded buffer problem (making

[4] The following is an incorrect solution to the bounded buffer problem (making use of a circular buffer). We use C-like syntax. The wait and signal are operations on condition variables. The get() entryprocedure is correct, all the errors are in the put() entryprocedure. In the space given to the right write the correct put() entryprocedure. It should be no more than 5-6 lines of code. You are not allowed to introduce additional ordinary variables or additional condition variables. monitor CBuffer { int IN = 0, OUT = 0; ITEM Buf[SIZE]; conditionvar Room, NonEmpty; ITEM entryprocedure get() { if (OUT == IN) NonEmpty.wait(); res = Buf[OUT]; OUT = (OUT+1) SIZE; Room. trigger(); return res; } entryprocedure put (ITEM it) { NonEmpty.signal(); IN = (IN+1) SIZE; Buf(IN] = it; if (OUT == IN) Room.wait(); } }

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!