Question: a) Program 6.4 has a binary semaphore s, local to each node. Why is it necessary? b) Suppose that the binary semaphore s is deleted



a) Program 6.4 has a binary semaphore s, local to each node. Why is it necessary? b) Suppose that the binary semaphore s is deleted from the method replyToDefferedNodes and the V(s) in thread handleRequests is moved up just before the if statement. Show that a deadlock is possible. c) Does the V(s) in replyToDefferedNodes need to be moved to the end of the method? In other words, why have a P(s)...V(s) bracket the single assignment statement requesting false? Where is the race condition? d) Suppose node m decides to enter its critical section and sends a request message to node n. Node n sends a reply message to node m indicating that node n does not want to enter its critical section. Suppose further that nodes n later decides to enter its critical section and sends a request message to node m. What happens if node n's request message is received by node m before the earlier-sent reply message of node n to node m? a) Program 6.4 has a binary semaphore s, local to each node. Why is it necessary? b) Suppose that the binary semaphore s is deleted from the method replyToDefferedNodes and the V(s) in thread handleRequests is moved up just before the if statement. Show that a deadlock is possible. c) Does the V(s) in replyToDefferedNodes need to be moved to the end of the method? In other words, why have a P(s)...V(s) bracket the single assignment statement requesting false? Where is the race condition? d) Suppose node m decides to enter its critical section and sends a request message to node n. Node n sends a reply message to node m indicating that node n does not want to enter its critical section. Suppose further that nodes n later decides to enter its critical section and sends a request message to node m. What happens if node n's request message is received by node m before the earlier-sent reply message of node n to node m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
