Question: 5. (10 points) We wish to execut sections, both functions use binars signall) are atomic semaphore operations. We wish to execute functions and concurrently. Therefore,
5. (10 points) We wish to execut sections, both functions use binars signall) are atomic semaphore operations. We wish to execute functions and concurrently. Therefore, to protect the critical actions use binary semaphores to guarantee mutual exclusion where wair and Binary semaphores Binary ant si - 52 - 53 - 53 - 54 -1; void f(void) { walt (S3); same code of wait (S2); same code .. wait (54) some code al signal (84); signal (S2); signal (83); 17 void g (void) { wait (S2); * Some code +/ wait (54); Some code +/ wait (S3); 1 Some code / signal (53); signal (S4); signal (S2); Examine the above code listing for deadlocks. If you believe that the code is prone to a deadlock, describe the specific scenario that may lead to a deadlock and propose a solution to fix the code. Note that your solution must not increase the locking granularity of the original solution. Hint: Use the concept of lock ordering and rewrite the original code if prone to deadlock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
