Lemma 1: we know at any table with a mixture of left-handed and right-handed philosophers, deadlock cannot occur. I very familiar with it proofs.
I ran into a following question on Interview recently.
There are 5 philosophers sitting at a round table. between each two philosophers there is a chopsticks. each philosophers need two chopsticks to eat. we have two type of philosophers: left-handed and right-handed. left-handed first take a chopsticks with left hands. right-handed first take a chopsticks with right hands. suppose among 5 philosophers there is at least 1 left-handed and at least 1 right-handed. which of them is True:
a) independent from the combination of placement philosophers at round table, there is no deadlock. (I sure True)
b) if all of the philosophers simultaneously take the first chopsticks, there is a deadlock. (I thin this is true because in implication if we have a-->b and a is false a-->b is true., and in this option there is no way to all philosopher simultaneously take the first chopsticks, so the whole statement is true.)
Any expert could help me, that I argument is True?
Edit 1: I add the proof for Lemma1: (but the question mentioned above has some differences. )
First observe that due to the pattern of resource acquisition around the table there is only one possible wait-cycle, i.e., the cycle involving all philosophers. So assume such a deadlock. Every philosopher must be waiting, by which we mean waiting for a chopstock held by another. Thus all chopsticks must be held. If our table has a mixture of left-handed and right-handed philosophers, there must be at least one pair of adjacent philosophers of opposite handedness. First assume a left-handed philosopher (“Lenny”) seated to the left of a right-handed philosopher (“Roger”). Because all chopsticks must be held, either Lenny or Roger must hold the chopstick which is between them. If Lenny holds it, that is his “right chopstick,” so he must previously have acquired the chopstick to his left. Thus Lenny holds two chopsticks, and is not waiting to acquire any (he is eating), so there is not a deadlock. If Roger holds the chopstick which is between them, that is his “left chopstick,” so he must previously have acquired the chopstock to his right, etc. If we call the previous case the “outward reaching” case, then the “inward reaching” case is a right-handed philosopher seated to the left of a left-handed philosopher. Again, if we have a deadlock, all chopsticks must be held, so one of them holds the chopstick between them. This means that the other one holds no chopsticks, since the one between them is the first one each will try to acquire (either Roger reached right and got it, or Lenny reached left and got it; the other is waiting for it before reaching in the outward direction). If there are n philosphers and n chopsticks, all chopsticks held, but one philosopher holds zero chopsticks, then n−1 philosophers hold n chopsticks. Some philospher must hold two chopsticks; that philosopher is not waiting (he is eating), so there is no deadlock.