Question: Consider the following solution for producer consumer problem: Prosucer While (TRUE){ item produce(); if (count == N) sleep(); lock (mutex); insert(item, buffer); count++; unlock

Consider the following solution for producer consumer problem: Prosucer While (TRUE){ item produce(); if (count == N) sleep(); lock (mutex); insert(item, buffer); count++; unlock (mutex); if (count == 1) wakeup (consumer); 14 Consumer While (TRUE){ if (count == 0) sleep(); lock (mutex); item= remove (buffer); count --; unlock (mutex); if (count = N-1) wakeup (producer); consume (iten); Q1) (2 pts) What is the problem with this solution and under what conditions it happens? 2 Q2) (2 pts) Use semaphore to solve the synchronization for this problem.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
