Question: Please make clear 2- Semaphores (25 pts). a) Consider a mystery soda machine that has 25 slots. The producer is the delivery person and the

Please make clear 2- Semaphores (25 pts). a)

Please make clear

2- Semaphores (25 pts). a) Consider a mystery soda machine that has 25 slots. The producer is the delivery person and the consumer is the professor using the machine. We use the following three semaphores: semaphore mutex semaphore fullBuffer /* Number of filled slots */ semaphore emptyBuffer /* Number of empty slots */ Given functions (see code) delivery person() and professor(): /* Initialize */ #define NUM_SLOTS 25 semaphore mutex = semaphore fullBuffer = semaphore emptyBuffer= delivery_person() { professor() { ?? ?? down(fullBuffer); down(mutex); take_1_soda_from_machine(); ?? put_1_soda_in_machine(); ?? ?? ?? } } . (9 pts) What will be the initial values of the semaphores? (12 pts) Write a solution that guarantees mutual exclusion and no deadlocks. (Part of the code for professor () and delivery_person() functions have been written) b) (4 pts) If the two down() functions inside the professor() section are interchanged [i.e., down(fullbuffer) and down(mutex) are interchanged], will your solution to the previous question will still be correct? If not, explain your reason

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 General Management Questions!