Question: We have a buffer with a finite capacity N , which is filled by the producer. We have two consumer processes A and B .

We have a buffer with a finite capacity N, which is filled by the producer. We have two consumer processes A and B.
Write the code of the consA and consB functions that will be called periodically by consumer A and consumer B, respectively.
Each function call affects 1 element. You must use semaphores with init, p, v operations.
Using semaphores, synchronization of access to the buffer should be ensured so that consumers read elements in the following order:
AABBAABBAABBAABB .....

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!