Question: 2- From the following code, answer these questions a- What is the role of the mutex? b-What is the role of condition variable condp? c-



2- From the following code, answer these questions a- What is the role of the mutex? b-What is the role of condition variable condp? c- What is the role of condition variable condc? d- Why there is a while loop in lines a and b instead of a simple if statement? e- What is the NULL for in line c? Which parameter is affected? * Solution to Producer Consumer Problem * Using Ptheads, a mutex and condition variables * From Tanenbaum, Modern Operating Systems, 3rd Ed. * In this version the buffer is a single number The producer is putting numbers into the shared buffer (in this case sequentially) And the consumer is taking them out. If the buffer contains zero, that indicates that the buffer is empty Any other value is valid. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
