
Philosopher |
ptolemy.domains.csp.demo.DiningPhilosophers.Philosopher |
A philosopher sits at a table with 4 other philosophers. Between
each two philosophers there is a chopstick. A Philosopher eats when he has
both chopsticks next to him. A Philosopher thinks for a while, then tries
to eat. When he succeeds in obtaining both chopsticks he eats for a while,
then puts both chopsticks back on the table and continues thinking.
<p>
Due to the rendezvous nature of communication in the CSP domain, a
philosopher stalls if it tries to get a chopstick but cannot. When
it acquires the chopstick, it eats for a while and then sends a
message to the chopstick to say that it is finished using it.
Note this actor has been slowed down with Thread.sleep() statements to
mimic the eating nature of the philosophers in real time.
<p>
This actor is parameterized by three parameters: "eatingRate" which
controls the distribution of the eating times, and "thinkingRate"
which controls the distribution of the thinking times. Both these
rates characterize a uniform distribution between 0 and the rate.
<p>
Author(s): Neil Smyth
Version:$Id: Philosopher.doc.html,v 1.1 2006/02/22 18:41:22 mangal Exp $
Pt.Proposed Rating:Red (nsmyth)
Pt.Accepted Rating:Red (cxh)
leftIn
The port through which this philosopher
is granted access to the left chopstick.
leftOut
The port through which this philosopher
releases access to the left chopstick.
rightIn
The port through which this philosopher
is granted access to the right chopstick.
rightOut
The port through which this philosopher
releases access to the right chopstick.
eating
This parameter determines the rate at which
this philosopher will spend time eating.
thinking
This parameter determines the rate at which
this philosopher will spend time thinking.