comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada advocacy
Date: Fri, 30 Aug 2013 18:41:33 -0400
Date: 2013-08-30T18:41:33-04:00	[thread overview]
Message-ID: <wccioymls2q.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: kvqlv5$255j$1@adenine.netfront.net

"Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org> writes:

> On 08/30/2013 09:54 AM, Robert A Duff wrote:
>> "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org> writes:
>>
>>> That's not quite right. P can also be executing E1 or E2, in which case
>>> it is not "willing" to do either. T will end up at (***) in both of
>>> those cases as well.
>>
>> I don't think you mean "P can also be executing...", you mean "some task
>> can also be executing...".
>
> If we're going to use informal, active phrasing such as "P is willing"
> we can also say "P is executing" without fear of misunderstanding.

Fair enough.  You're right -- I didn't misunderstand you.

>> But anyway, no, unless I'm missing something, there are only two
>> possible states.  If some task is executing the body of P.E1, then P
>> must be locked.  So if another task comes along and tries to call one of
>> the entries, it will try to lock P, and will not proceed until the first
>> task leaves E1.  At that point, the second task will check the barrier[*],
>> and find it in one of the two possible states.[**]
>
> That's even worse.

I don't think so.  I'll try to explain why below.

>...Task T is delayed waiting for the other task to
> complete execution of P.E1, which can be a long time.

It can be, but it should not be.  Entry bodies should be kept short
(at least in real-time systems, or other cases where such things
matter).

But in any case, it's what you want in this case -- task T must be
"delayed waiting" until the other task has (quickly, we hope) set the
state to one of the two possible states.  We don't want it to see some
oddball intermediate state.

>...Those of us who
> are not language lawyers (especially those who started with Ada 83)
> expect a conditional entry call to send the calling task to the else
> part immediately if the entry call cannot proceed.

"Immediately" does not mean "in zero time".  Not in Ada RM jargon,
anyway.

In the rendezvous case, the task doing the conditional entry call is
quite likely to take LONGER (in real time) to notice that the entry is
not open (than in the protected object case).  And therefore longer to
jump to the 'else' part.  I have implemented this stuff, and I know what
goes on behind the scenes -- there's (hidden) locking in the rendezvous
case, too, and yes that means that it can take some time to decide to
jump to the 'else'.

>... (Maybe that's not
> what the language rules say, but that's how it's usually presented.)
> Once T sees that P is locked, it should go to the else part.

That semantics doesn't seem like a good idea to me, because "P is
locked" means "P is in the middle of a state change".  The whole point
of locking is to prevent clients from seeing that "in the middle" state.

>...If the
> author of T were willing to be delayed waiting to get access to P, T
> would have used a timed entry call.

A timed entry call with "delay 0.0" has identical semantics to a
conditional entry call.  In both cases (rendezvous and protected
object), the calling task has to lock something before it can decide
whether the call can be done "immediately", and that locking takes
nonzero time.

Think about the semantics of a timed call with "delay
0.000_000_000_000_000_000_001".

- Bob

  reply	other threads:[~2013-08-30 22:41 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 12:54 Ada advocacy tonyg
2012-03-20 13:54 ` Ludovic Brenta
2012-03-20 14:39 ` Marc C
2012-03-20 15:13   ` Ludovic Brenta
2012-03-20 16:34     ` Yannick Duchêne (Hibou57)
2012-03-20 16:35       ` Yannick Duchêne (Hibou57)
2012-03-20 20:06   ` Shark8
2012-03-20 15:42 ` Georg Bauhaus
2012-03-20 18:31 ` Jeffrey Carter
2012-03-20 21:42 ` anon
2012-03-20 23:05   ` Shark8
2012-03-21  0:32 ` Shark8
2012-03-21  1:58 ` Robert Love
2012-03-21  5:37   ` Per Sandberg
2012-03-25 11:10     ` Peter C. Chapin
2012-03-21  8:59   ` anon
2013-06-17 23:42     ` johannes falcone
2013-06-18  0:09       ` tmoran
2013-06-18  0:14     ` Leo Brewin
2013-06-18  0:59       ` Jeffrey Carter
2013-06-19 19:22         ` johannes falcone
2013-06-19 19:34           ` Jacob Sparre Andersen
2013-06-19 20:16             ` Shark8
2013-06-19 19:36           ` Ludovic Brenta
2013-08-30  7:36             ` johannes falcone
2013-06-18  1:28       ` Dennis Lee Bieber
2013-06-18  5:55         ` Peter Brooks
2013-06-18 17:15           ` Robert A Duff
2013-06-18 17:43             ` Bill Findlay
2013-06-18 19:22               ` Robert A Duff
2013-06-18 19:30                 ` Bill Findlay
2013-08-27 13:34             ` Yannick Duchêne (Hibou57)
2013-08-27 14:08               ` Bill Findlay
2013-08-27 14:13                 ` Bill Findlay
2013-08-27 21:25               ` J-P. Rosen
2013-08-28  7:45                 ` Dmitry A. Kazakov
2013-08-27 22:42               ` Dennis Lee Bieber
2013-08-28  7:45               ` Maciej Sobczak
2013-08-28  8:58                 ` Georg Bauhaus
2013-08-28  9:42                   ` Dmitry A. Kazakov
2013-08-28 11:42                     ` G.B.
2013-08-28 11:59                       ` Dmitry A. Kazakov
2013-08-28 12:49                         ` G.B.
2013-08-28 14:07                           ` Dmitry A. Kazakov
2013-08-28 15:06                             ` Eryndlia Mavourneen
2013-08-28 17:30                               ` Dmitry A. Kazakov
2013-08-28 16:44                       ` Yannick Duchêne (Hibou57)
2013-08-28 17:25                         ` Dmitry A. Kazakov
2013-08-28 23:33                           ` Dennis Lee Bieber
2013-08-29  7:15                             ` Dmitry A. Kazakov
2013-08-29 14:47                           ` Yannick Duchêne (Hibou57)
2013-08-29 19:15                             ` Dmitry A. Kazakov
2013-08-29 15:28               ` Robert A Duff
2013-08-29 21:43                 ` Jeffrey R. Carter
2013-08-30 23:52                   ` Yannick Duchêne (Hibou57)
2013-08-31  0:05                     ` Jeffrey R. Carter
2013-08-31  1:42                       ` Shark8
2013-08-31  2:57                       ` Shark8
2013-08-31  9:00                         ` Dirk Craeynest
2013-08-31  1:48                   ` Randy Brukardt
2013-09-02  7:13                   ` Egil H H
2013-09-02  8:41                     ` G.B.
2013-09-02 16:37                       ` Egil H H
2013-08-29 15:46               ` Robert A Duff
2013-08-30  4:47                 ` Jeffrey R. Carter
2013-08-30 16:54                   ` Robert A Duff
2013-08-30 17:49                     ` Jeffrey R. Carter
2013-08-30 22:41                       ` Robert A Duff [this message]
2013-08-31  0:02                         ` Jeffrey R. Carter
2013-08-31 14:47                           ` Robert A Duff
2013-06-19  7:29           ` nevillednz
2013-08-27 13:39             ` Yannick Duchêne (Hibou57)
2013-09-02 18:45           ` Martin
2013-06-17 23:39   ` johannes falcone
2012-03-21 10:44 ` tonyg
2013-06-18  0:07   ` johannes falcone
2012-03-23 16:13 ` KK6GM
2013-06-13 15:33 ` david
2013-06-13 15:34 ` david
  -- strict thread matches above, loose matches on Subject: below --
2003-08-26 20:33 Ada Advocacy Stephane Richard
2003-08-26 21:20 ` Luke A. Guest
2003-08-26 22:28   ` Stephane Richard
2003-08-26 23:04     ` Luke A. Guest
2003-08-27 16:15       ` Warren W. Gay VE3WWG
2003-08-27 23:06         ` Luke A. Guest
2003-08-28 10:39           ` Preben Randhol
2003-08-26 23:55   ` Chad R. Meiners
2003-08-27  0:44   ` Anisimkov
2003-08-27  8:26     ` Dmitry A. Kazakov
2003-08-27 20:12       ` Wes Groleau
2003-08-27 23:09         ` Luke A. Guest
2003-08-29 16:13           ` Jon S. Anthony
2003-08-29 18:15             ` Luke A. Guest
2003-08-28  8:34         ` Dmitry A. Kazakov
2003-08-27  8:29     ` Luke A. Guest
2003-08-28  5:29       ` Dmitriy Anisimkov
2003-09-01 21:26   ` Dave Thompson
2003-08-27  6:56 ` David Holm
2003-08-27 16:00 ` Rod Chapman
2003-08-29  6:38 ` Adrian Hoe
2003-08-29  9:34   ` Stephane Richard
2003-09-01  5:45     ` Adrian Hoe
replies disabled

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