Question: D) (16pte) Below is a semaphore solution for the producer/consumer problem. The buffer can hold n items. Semaphores are X, Y and Z I The
D) (16pte) Below is a semaphore solution for the producer/consumer problem. The buffer can hold n items. Semaphores are X, Y and Z I The buffer is initialized to be empty and is processed as a first in first out # queue M PRODUCER CODE while(true) 1. getitem(); 2. Wait : 3. wait(Z): 4. additernToBuffer): 5. signal(Z): 6. signal(Y): } CONSUMER CODE while(true) { 1. wait(Y): 2. wait(); 3. readitemFromBuffer(); 4. signal(z: 5. signalx: 6. processitem There is a problem with each of the semaphore initializations below. Give a sequence of statements showing how an error might occur. For instance, can the Producer and Consumer be in their entical sections at the same time? Will deadlock ocur? Please note, for full credit, you must you must lista sequence of statements that lead to an error. You will not get credit for guessing A XOY HOZNI 21 0.2- 31 X Y 0.22 4) X= 0.21
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
