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.]
semaphore chopsticks = 1; /* assume these are binary semaphores */
Hi there! Click one of our representatives below and we will get back to you as soon as possible.