Closed oakfire closed 9 years ago
Your output is valid, but so is the example in the book. There can be two philosphers eating at the same time, for example, Spinoza (0, 1) and Marx (2, 3). Just because it doesn't happen in your case, doesn't mean it isn't possible.
I think this should probably be closed, but I'll let @steveklabnik decide.
@Aatch Thank you, I am understand it is possible. But the difference confused me for a while, make me guess the 'mutex' worked in the abnormal state.
Yes, this output is non-deterministic, so you won't necessarily get the same output.
dining-philosophers I ran the last example code and I got:
It is different from the book:
So I add some code to find why:
and the result is
The book said:" Only two philosophers can eat at any one time,", that is not exactly correct.