0 votes 0 votes Mutual exclusion, hold and wait, circular wait and no preemption are 4 necessary condition for deadlock to occur. How mutual exclusion is present in the dining philosopher problem? Operating System operating-system + – Swapnil Naik asked Nov 21, 2018 Swapnil Naik 361 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Shaik Masthan commented Nov 22, 2018 reply Follow Share comments of this question helps you https://gateoverflow.in/226875/critical-section 0 votes 0 votes Swapnil Naik commented Nov 30, 2018 reply Follow Share Shaik I am quite surprised why it is happening like that, Deadlock should not occur if any of those 4 condition does not hold, I checked for circular wait it was there, no preemption and hold and wait was there but mutual exclusion was absent. It means deadlock should not occur. Galvin only says to prevent deadlock one of the condition should not hold, but the example given by abhishekme.. is telling something different story only. It shouldn't happen, if all 4 conditions are satisfying then deadlock has to be there and if mutual exclusion is absent then there won't be any deadlock. Please clarify this as soon as possible, as this is one of the core concept. 0 votes 0 votes Shaik Masthan commented Nov 30, 2018 reply Follow Share Actually it depends upon the entry section of Critical Section... Normally, we use entry section is similar semaphores for every process, but in that example which abhishek mentioned, there are different semaphores for the processes 0 votes 0 votes Swapnil Naik commented Nov 30, 2018 reply Follow Share Give me some time I will get back to you. 0 votes 0 votes Swapnil Naik commented Dec 1, 2018 reply Follow Share Okay I have come to this conclusion, The code is kind of implementation of dining philosopher problem. The code implementation does maintain mutual exclusion by maintaining that one fork will be only picked by one user.( wait(i) condition) but because of other fork deadlock is occurring, mutual exclusion is still there. both of them maintain mutual exclusion by saying that at any given time one fork will be only picked by one person. p[0] and p[2] can eat at the same time, accessing their critical section and hence still maintaining mutual exclusion property. Here the mutual exclusion is applied on the fork. Hence mutual exclusion becomes the necessary condition for deadlock to occur. 0 votes 0 votes Please log in or register to add a comment.