
Modern dining philosophers - ahiknsr
http://lucteo.ro/2018/12/28/modern-dining-philosophers/
======
danielvf
This is kind of cheating. :)

This solution doesn't really cover the core problem in the dining philosophers
puzzle - that your philosophers can't communicate with each other or some
external system to coordinate!

Having a single external controlling process allocating all forks makes the
whole problem trivial (at least until one of the philosopher processes crashes
and never notifies the controller that they are done with the forks they were
using). This solution also uses a library that provides the underlying thread-
safe communication, which hides another layer of complexity.

If your problem lets you get away with this, then HECK YES, do it! This is a
fantastic solution that avoids most of the resource sharing gotchas. This kind
of solution pops up pretty naturally in Erlang/Elixier with extremely
lightweight processes and built-into-the-language safe message passing.

If you can change the constraints a little to make a hard problem into a
simple problem, do it!

------
PhasmaFelis
Did the original version use forks and spaghetti? I was taught chopsticks and
rice, which makes more sense to me; you clearly need two chopsticks to pick up
rice, but you don't need two forks for anything, let alone spaghetti.

Obviously the metaphor doesn't bear close inspection in any version, but that
bugged me a bit.

~~~
macintux
Hoare formulated the problem in _Communicating Sequential Processes_ , using
spaghetti and two forks. See page 55.

[http://www.usingcsp.com/cspbook.pdf](http://www.usingcsp.com/cspbook.pdf)

------
SilasX
I really appreciated the explanation and diagrams of the DPP. No comment on
the solutions discussed though.

