3,131 views

2 Answers

3 votes
3 votes

1) is correct

Because if (n-1) philosopher first take left fork fist then right fork, then remaining 1 fork can take a philosopher as a right fork, who already got a left fork

So, 1 philosopher satisfies condition of eating and he eat. And if 1 one satisfies condition, others also will satisfy. So no deadlock.

Similarly 2) also satisfies condition

So, 1 and 2 are correct

0 votes
0 votes

Order the chopsticks, so that the philosopher has to pick up chopstick N, then chopstick N+1. This means that one of the philosophers will pick up his right chopstick first, while all of the others are picking up the left chopstick first. This is the same as having odd numbered philosophers pick up their chopsticks left/right, and even numbered philosophers pick up theirs right/left. This solution relies on breaking the circular wait. Also, every philosopher will get to eat at some point.

http://wiki.c2.com/?DiningPhilosophers

both i and 2 are correct.

No related questions found