Till KTH:s startsida Till KTH:s startsida

Dining philosophers

Five philosphers contemplating life and eating noodles is a classical problem. If they are not that hungry things will work without problem but if they all eat more than they dream things will be more problematic. 

When you have done the assignment you should take a look at the following assignment that will explain what is going on in some more detail. Do solve the philosophers assignment first and then read this text, you learn more if you first do it wrong, and then realize that it is wrong, rather then doing it right from the beginning by following a given trail.

Teacher Johan Montelius created page 19 January 2015

Teacher Johan Montelius changed the permissions 29 January 2015

Kan därmed läsas av alla och ändras av lärare.
Johan Montelius edited 17 February 2016

Five filosphers contemplating life and eating noodles is a classical problem. If they are not that hungry things will work without problem but if they all eat more than they dream things will be more problematic. 


* philosophers.pdf
If you have time and want to see how the philosophers behave, you could use this little gui. Start a gui process for each philosopher and let i send messages to it depending on its state. To work you need toe have the wx module working - it should if you have the Erlang Solutions version of the Erlang system.¶


* gui.erl

Johan Montelius edited 18 February 2016

Five filosphers contemplating life and eating noodles is a classical problem. If they are not that hungry things will work without problem but if they all eat more than they dream things will be more problematic. 


* philosophers.pdf
If you have time and want to see how the philosophers behave, you could use this little gui. Start a gui process for each philosopher and let i send messages to it depending on its state. To work you need toe have the wx module working - it should if you have the Erlang Solutions version of the Erlang system.


* gui.erl
When you have done the assignment you should take a look at the following assignment that will explain what is going on in some more detail. Do solve the philosophers assignment first and then read this text, you learn more if you first do it wrong, and then realize that it is wrong, rather then doing it right from the beginning by following a given trail.¶


* mutex.pdf

Johan Montelius edited 19 February 2016

Five filosphers contemplating life and eating noodles is a classical problem. If they are not that hungry things will work without problem but if they all eat more than they dream things will be more problematic. 


* philosophers.pdf
If you have time and want to see how the philosophers behave, you could use this little gui. Start a gui process for each philosopher and let i send messages to it depending on its state. To work you need toe have the wx module working - it should if you have the Erlang Solutions version of the Erlang system.


* gui.erl
When you have done the assignment you should take a look at the following assignment that will explain what is going on in some more detail. Do solve the philosophers assignment first and then read this text, you learn more if you first do it wrong, and then realize that it is wrong, rather then doing it right from the beginning by following a given trail.


* mutex.pdf

Johan Montelius edited 19 February 2016

Five filosphers contemplating life and eating noodles is a classical problem. If they are not that hungry things will work without problem but if they all eat more than they dream things will be more problematic. 


* philosophers.pdf
If you have time and want to see how the philosophers behave, you could use this little gui. Start a gui process for each philosopher and let i send messages to it depending on its state. To work you need toe have the wx module working - it should if you have the Erlang Solutions version of the Erlang system.


* gui.erl
When you have done the assignment you should take a look at the following assignment that will explain what is going on in some more detail. Do solve the philosophers assignment first and then read this text, you learn more if you first do it wrong, and then realize that it is wrong, rather then doing it right from the beginning by following a given trail.


* mutex.pdf
Some examples of how we can implement the different versions of chopsticks and one version is used by the philosophers.¶


* chopstick.erl
* philosphere.erl
* dinner.erl