GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
131 views
In dining philosophers Algorithm the  minimum number of forks or chopsticks  to avoid deadlock is (assume there are 5 philosophers)

a. 5

b. 6

c. 10

d. None of these
asked in Operating System by (135 points)   | 131 views

1 Answer

+2 votes

Answer is B

all 5 philosopher will take 1 fork each and then remaining one fork can be taken by any philosopher hence total (5+1)=6

 

answered by Loyal (3.2k points)  
Sir If we use 6 forks or chopsticks  we can prevent  deadlock
If we distribute 5 forks among the philosophers then all of them will wait for 1 more so for deadlock condition is 5 and if we provide one more then there will be no deadlock because any philosopher will take the 6th fork and after eating it will return both its fork which will be distributed among the other philosopher hence no deadlock
but if we consider the  algorithm ...then 5 forks are enough to resolve the problem....
@hs_yadav

5 forks will lead to deadlock, either increase one fork(5+1=6) or decrease one philospher(5-1=4) will gurantee no deadlock..
then i think it would be a simple dead lock problem not a dining philospher prob...

as in the case of DP problem every philospher first took the left fork and then right fork(it leads a problem) but if we restrict one philospher i.e first it will took right and then left ...

then i think 5 forks will not lead to deadlock....
if 5 philosophers take one fork each

now they all will wait for one more fork

because they wont release their forks until they get both

so u need 6 to break that
@hs_yadav

yes for sure this is not standard dining philosopher problem because in that standard problem already all the forks would be given by default and here in the name of philosopher it is easy and straight forward question is given


Top Users Sep 2017
  1. Habibkhan

    6836 Points

  2. Arjun

    2310 Points

  3. Warrior

    2306 Points

  4. rishu_darkshadow

    2064 Points

  5. A_i_$_h

    2000 Points

  6. nikunj

    1980 Points

  7. manu00x

    1750 Points

  8. Bikram

    1744 Points

  9. SiddharthMahapatra

    1718 Points

  10. makhdoom ghaya

    1690 Points


26,037 questions
33,647 answers
79,694 comments
31,069 users