The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+3 votes
221 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 (165 points) | 221 views

1 Answer

+3 votes
Best answer

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.6k points)
selected by
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


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,115 questions
36,926 answers
91,928 comments
34,782 users