> I think what you want is like the attached.
Yes it is that, thank you.


2007/12/22, Edward A. Lee <[EMAIL PROTECTED]>:

> The display actor reads from all input channels in sequence, top to bottom.

Is any actor (in the Rendezvous domain) reads from all input channels
in that sequence ? And write ? In other words it is the rule in the
Rendezvous domain ?

For example ResourcePool actor should write the first resource in the
pool to *any* grant output channel:

From ResourcePool's documentation:

     *  Then, in the calling thread, if there is at least one
     *  resource in the pool, write the first resource in the pool
     *  to any <i>grant</i> output channel.

But in the attached file, ResourcePool waits for writing to top
channel, ResourcePool  *could* write to bottom channel, but it waits
for top and write to top. Why it is so ? I expect that it writes to
bottom channel, because top channel actor is not ready, it sleeps. It
seems like there is conflict between rule of sequencing writing to and
reading from channels and ResourcePool's documentation.

> In you first model, it will want to participate in a multiway rendezvous with
> the top loop, then with the bottom. If those loops are not able to perform
> rendezvous in that order, then deadlock.

> In the second model, the Display has only one input channel
> and all participants linked via the relations will want to rendezvous
> at once.  This model actually shouldn't be allowed in the Rendezvous domain
> because multiple output ports are connected to the same relation...
> This should be checked an exception should be thrown. The implementation
> may have an effect similar to the attached model, but who knows...
>
> Edward
>
> At 03:30 PM 12/21/2007, =?KOI8-R?B?8MXU0s/XIOHMxcvTwc7E0g==?= wrote:
> >To Edward Lee:
> >Thank you for your answer.
> >
> >Could somebody explain why that model -
> >http://files.rsdn.ru/39468/ResourcePoolDeadlock.xml - is always hang
> >(deadlocked) ?
> >And why this model - http://files.rsdn.ru/39468/ResourcePoolOK.xml -
> >is hang sometimes, but sometimes works.
> >
> >It seems to me, that when Display actor accepts some multiway
> >rendezvous, he can't accepted another multiway rendezvous. And the
> >chance that he accepts that or this rendezvous (up or bottom in the
> >model ResourcePoolDeadlock) is depend on the order in which we connect
> >Display Actor to Expression actors. Am I right ?
> >
> >I think so, because if I set Sleep2 value to 50L (and so value 3
> >should be displayed), Display actor nevertheless display value 2, from
> >up Expression actor. But if I change the order, which I connected
> >Expression actors to Display Actor and change the order of of
> >connection Sleep actors to ResourcePool actors, than behaviour will be
> >different.
> >
> >With all these refinements I think, that it might be more convenient
> >to work with Rendezvous domain not in the Vergil, by directly using
> >programming language (based on CSP and build in Ptolemy II, like Cal).
> >
> >Petrov Alexander
> >2007/12/22, Петров Александр <[EMAIL PROTECTED]>:
> >> ---------- Forwarded message ----------
> >> From: Edward A. Lee <[EMAIL PROTECTED]>
> >> Date: 22.12.2007 0:45
> >> Subject: Re: Model Readers-Writers Problem
> >> To: Петров Александр <[EMAIL PROTECTED]>
> >> Cc: ptolemy-hackers@bennett.eecs.berkeley.edu
> >>
> >>
> >>
> >> Rendezvous is a good domain for modeling mutual exclusion as
> >> well as other resource management problems. The ResourcePool demo
> >> in that domain illustrates this.
> >>
> >> Edward
> >>
> >> At 12:32 PM 12/21/2007, =?KOI8-R?B?8MXU0s/XIOHMxcvTwc7E0g==?= wrote:
> >> >Hello, Ptolemy Hackers,
> >> >
> >> >I struggle with modelling reader-writer sample. This sample assumes
> >> >that there is something like shared state. And the problem is to model
> >> >mutual exclusion between Reader - Writer, and between Writer - Writer.
> >> >So I have to model shared state in purely message-passing,
> >> >actor-oriented framework PtolemyII. Only think I've found to do that
> >> >is parameters, that global for model and that can be read and written
> >> >by Expression actor. But it seems like workaround to the problem.
> >> >
> >> >Does anybody has sample (in any Domains (with any Directors))
> >> >modelling Readers-Writers problem ? Or some ideas how achieve that in
> >> >Ptolemy II.
> >> >
> >> >Thank you.
> >> >
> >> >Petrov Alexander
> >> >[EMAIL PROTECTED]
> >> >
> >> >----------------------------------------------------------------------------
> >> >Posted to the ptolemy-hackers mailing list.  Please send administrative
> >> >mail for this list to: [EMAIL PROTECTED]
> >>
> >> ------------
> >> Edward A. Lee
> >> Chair of EECS and Robert S. Pepper Distinguished Professor
> >> 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
> >> phone: 510-642-0253, fax: 510-642-2845
> >> [EMAIL PROTECTED], http://www.eecs.berkeley.edu/Faculty/Homepages/lee.html
> >>
> >
> >
> >----------------------------------------------------------------------------
> >Posted to the ptolemy-hackers mailing list.  Please send administrative
> >mail for this list to: [EMAIL PROTECTED]
>
> ------------
> Edward A. Lee
> Chair of EECS and Robert S. Pepper Distinguished Professor
> 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
> phone: 510-642-0253, fax: 510-642-2845
> [EMAIL PROTECTED], http://www.eecs.berkeley.edu/Faculty/Homepages/lee.html
>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
    "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd";>
<entity name="ResourcePool_GrantToAnyl" class="ptolemy.actor.TypedCompositeActor">
    <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="6.0.2">
    </property>
    <property name="Rendezvous Director" class="ptolemy.domains.rendezvous.kernel.RendezvousDirector">
        <property name="_location" class="ptolemy.kernel.util.Location" value="[80.0, 50.0]">
        </property>
    </property>
    <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={169, 329, 815, 507}, maximized=false}">
    </property>
    <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[600, 400]">
    </property>
    <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0">
    </property>
    <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{217.8911528716216, 180.2445101351351}">
    </property>
    <entity name="ResourcePool" class="ptolemy.domains.rendezvous.lib.ResourcePool">
        <property name="initialPool" class="ptolemy.data.expr.Parameter" value="{0}">
        </property>
        <property name="ResourcePoolIcon" class="ptolemy.vergil.icon.EditorIcon">
            <property name="rectangle" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
                <property name="_location" class="ptolemy.kernel.util.Location" value="22.0, -1.0">
                </property>
                <property name="width" class="ptolemy.data.expr.Parameter" value="97.0">
                </property>
                <property name="height" class="ptolemy.data.expr.Parameter" value="31.0">
                </property>
                <property name="centered" class="ptolemy.data.expr.Parameter" value="true">
                </property>
                <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 1.0, 1.0, 1.0}">
                </property>
            </property>
            <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
                <property name="textSize" class="ptolemy.data.expr.Parameter" value="10">
                </property>
                <property name="text" class="ptolemy.kernel.util.StringAttribute" value="initial pool:">
                </property>
                <property name="_location" class="ptolemy.kernel.util.Location" value="[-28.0, -16.0]">
                </property>
            </property>
            <property name="ParameterValue" class="ptolemy.vergil.kernel.attributes.AttributeValueAttribute">
                <property name="textSize" class="ptolemy.data.expr.Parameter" value="10">
                </property>
                <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{1.0,0.0,0.0,1.0}">
                </property>
                <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="initialPool">
                </property>
                <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="20">
                </property>
                <property name="_location" class="ptolemy.kernel.util.Location" value="[-28.0, -2.0]">
                </property>
            </property>
            <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={34, 236, 937, 518}, maximized=false}">
            </property>
            <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[722, 400]">
            </property>
            <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="4.0">
            </property>
            <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{0.0, 0.0}">
            </property>
        </property>
        <property name="_location" class="ptolemy.kernel.util.Location" value="[90.0, 205.0]">
        </property>
    </entity>
    <entity name="Sleep" class="ptolemy.actor.lib.Sleep">
        <property name="sleepTime" class="ptolemy.actor.parameters.PortParameter" value="100L">
        </property>
        <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
            <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="sleepTime">
            </property>
            <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="40">
            </property>
        </property>
        <property name="_location" class="ptolemy.kernel.util.Location" value="[220.0, 160.0]">
        </property>
    </entity>
    <entity name="Display" class="ptolemy.actor.lib.gui.Display">
        <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={441, 613, 332, 172}, maximized=false}">
        </property>
        <property name="_location" class="ptolemy.kernel.util.Location" value="[320.0, 160.0]">
        </property>
    </entity>
    <entity name="Display2" class="ptolemy.actor.lib.gui.Display">
        <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={474, 426, 332, 172}, maximized=false}">
        </property>
        <property name="_location" class="ptolemy.kernel.util.Location" value="[320.0, 245.0]">
        </property>
    </entity>
    <relation name="relation" class="ptolemy.actor.TypedIORelation">
        <property name="width" class="ptolemy.data.expr.Parameter" value="1">
        </property>
    </relation>
    <relation name="relation3" class="ptolemy.actor.TypedIORelation">
        <property name="width" class="ptolemy.data.expr.Parameter" value="1">
        </property>
    </relation>
    <relation name="relation2" class="ptolemy.actor.TypedIORelation">
        <property name="width" class="ptolemy.data.expr.Parameter" value="1">
        </property>
    </relation>
    <link port="ResourcePool.grant" relation="relation"/>
    <link port="ResourcePool.grant" relation="relation2"/>
    <link port="Sleep.input" relation="relation"/>
    <link port="Sleep.output" relation="relation3"/>
    <link port="Display.input" relation="relation3"/>
    <link port="Display2.input" relation="relation2"/>
</entity>

Reply via email to