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)

"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

Comments are closed.

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp