Question: need asap 10 pts D Question 18 Consider a situation where you have a critical data item that will be updated as well as read

need asap need asap 10 pts D Question 18 Consider a situation where you

10 pts D Question 18 Consider a situation where you have a critical data item that will be updated as well as read by multiple threads. Condition is all the data updates need to be consumed in the same order. Thus, reads and writes need to be interleaved (Assume that this implementation is C#based) // buffer for an integer // flag class BufferClass? private int bufferCell = -1; private boolean writeable = true; public void setBuffer(int val) { while (!writeable) 1 bufferCell setBuffer) getBuffer) writeable } bufferCell = val; writeable = false; } public int getBuffer() { while (writeable) 1 writeable = true; return bufferCell; } a) (4 Pts) Above implementation has some flaws in achieving the requirements mentioned. Clearly explain the issue with above implementation b) (6 Pts] Modify the above code that fix the flaws identified in part () above (Write the COMPLETE code for buffer class implementation above that fix the flaws identified in part (a)) Edit View Insert Format Tools Table

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!