Dining philosophers in Erlang

Jani Launonen <>
Fri Apr 12 22:30:50 CEST 2002


Hello,

I've been in Formal Methods course and there were presented message passing
language that had communications channels that could be both read and
written. The dining philosophers -problem could be solved by storing
"available" information about chop stick in a channel (that is dining
philosopher process could write "available" to the channel and if it
weren't consumed by it's neighbour, one could read it back by itself). This
is something impossible in Erlang - as one can write only to a another
process - so how could one solve the problem in Erlang in most elegant way?
I cannot think of solution that doesn't involve having a chop stick process
that has only use for responding whether chop stick in question is
available or not. Is it possible to not to have chop stick process (and
have the required parallelism) in most basic Erlang possible? Could someone
more enlightened Erlanger explain this more elegant solution, please?

Cheers,

-+-+-+-
Jani Launonen
Student. . . . . . . . . .University of Oulu, Dept. of EE
Assistant Researcher . . .Genie of the Net Project

"Computing is a field which has one of the shortest collective memories
of any engineering or scientific discipline." - Marty Fouts, comp.distributed




More information about the erlang-questions mailing list