comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Newbie: Clarification of non-determinsitcis selection in Ada rendevous Mechanism
Date: 2000/05/17
Date: 2000-05-17T00:00:00+00:00	[thread overview]
Message-ID: <wccg0rh1eyn.fsf@world.std.com> (raw)
In-Reply-To: 8fstnl$dd$1@news.ihug.co.nz

"nootah" <nootah@ihug.co.nz> writes:

> Question is: if the selection of action from a select clause is
> non-deterministic, then does the active object pause at the select statement
> or does it elect one of the processes to wait for - the altter is what I
> have been told.

No, that's wrong.  The task waits at the select statement.  Whatever
calling task comes in first gets accepted (assuming there are no guards,
or all guards are true).  The called task does not choose which one to
wait for when it doesn't know which one is going to happen!

The nondeterminism mainly comes into play when there are two or more
tasks already waiting in entry queues when the select statement is
reached.  In that case, a caller is selected nondeterministically,
according to the core RM semantics.  In the Real Time Annex, however,
the selection criteria are nailed down more tightly.

>... My problem with this - if multiple guard conditions are
> simultaneously true, and one is selected prior to any call, then what occurs
> when one of the client processes calls another guarded func.

Good point -- that rule wouldn't work very well.  Luckily, that's not
the rule.  ;-)

> e.g. where a=5
> 
>     select
>         when a>0 =>
>             accept(FirstFunc)
>         when a<10 =>
>             accept(SecondFunc)
>         end select
>     end select
> 
> If object halts at select and waits for request from client
>     what happens if func called and guard condition not fulfilled ? -
> presumably client blocks until condition met and task can respond - queues
> the request and blocks client

Right.  (That's not the above example -- in the above example, both
guards are True.)

> On the other hand, if object elects FirstFunc, but client SecondFunc is
> first call received - what happens ? presumably .. I have no idea!

The task does not elect FirstFunc unless and until there's a caller for
FirstFunc.

- Bob




  reply	other threads:[~2000-05-17  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-17  0:00 Newbie: Clarification of non-determinsitcis selection in Ada rendevous Mechanism nootah
2000-05-17  0:00 ` Robert A Duff [this message]
2000-05-17  0:00   ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox