write my assignment 1805

Consider the following solution to the dining Philosopher problem (which was discussed in class but has a deadlock problem). Rewrite the code below to resolve the deadlock problem such that even-numbered philosophers select chopsticks to their right, first, then to their left; and odd-numbered philosophers select chopsticks to their left, first, then to their right. [Note: Assume the P() and V() are two primitive functions that guard the entrance and exit of the critical section.]

           Philosopher(i) {

               semaphore chopsticks[5] = 1;                          /* assume these are binary semaphores */

               while (true)

 
"Not answered?"
Get the Answer