comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <brad.moore@shaw.ca>
Subject: Re: Safety of unprotected concurrent operations on constant objects
Date: Wed, 14 May 2014 08:30:44 -0600
Date: 2014-05-14T08:30:44-06:00	[thread overview]
Message-ID: <p6Lcv.30466$Ca5.21667@fx27.iad> (raw)
In-Reply-To: <lktv6n$kit$1@loke.gir.dk>

On 14-05-13 02:27 PM, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:1tb8my720vum2$.r9u7r03btzqm.dlg@40tude.net...
> ...
>>> I think most protected objects typically do not call unsafe subprograms.
>>
>> They do. It is an unrelated case, as I said, task safety needs to support
>> blocking, but still it is a usable pattern, that is to pass an unsafe
>> operation to a protected object's entry in order to execute it on the
>> context of a protected action.
>
> I don't think you guys are even talking about the same problem. Brad's
> Task_Sfae idea (which is similar to an idea I had years ago is aimed at
> providing idiot-proof concurrency. This is necessarily going to be a rather
> small subset of all of the possibilities of concurrency. Ada surely does not
> need new ways to do complex concurrency; it has lots of ways to shoot
> yourself in the foot now, and all of the flexibility one could possibly
> want.

Agreed. The Aspects I had in mind are not about coming up with new ways 
of doing concurrency, only about presenting a better picture to the 
client of the subroutine (both the compiler and the programmer), so that 
programmers can make use of concurrency or parallelism hopefully with 
less chance of shooting themselves in the foot. (i.e more safely)

>
> But for a lot of problems, bog-simple parallel execution of code is enough,
> and for that, one wants to allow a very restricted set of operations which
> prevent trouble by construction. That's the purpose of Task_Safe and similar
> ideas.

Right.

>
> In the long run, the Ada has to have an easier way to construct parallel
> programs. Raw tasks are pretty much like programming in C, given the lack of
> any protection from making mistakes -- it's not at all like Ada in other
> areas. Whether one can do everything that they might want safely is not
> relevant.
>
> Something like Task_Safe can be very restrictive, simply because one can
> always write separate tasks if they need something more complex. It
> certainly don't have to allow everything.

And also the use of Task_Safe is optional. If one wants to work in a 
less restrictive environment, they dont have to use the aspect.

>
>> In any case, before messing up with attributes we should IMO concentrate
>> efforts on integrating SPARK into Ada and having language mandated provers
>> and language infrastructure supporting provers on programmer's demand,
>> like
>> proper pre-/postconditions, axioms etc. Once this is in place and working
>> we could start thinking how to formalize concurrency aspects within this
>> framework. Otherwise it is putting the cart before the horse.
>
> I'm hestitant to say "never", but I think it is highly unlikely that Ada
> (the programming language) will ever include any proof technology. That's
> because it's simply too difficult to formally describe the rules involved.
> Even relatively simple rules (such as errors for always out of range values)
> are too hard to add to Ada without pages of rules or far too many false
> positives (or usually both).

And to be clear, when I mention proving task safety with these aspects, 
I do not mean formal proof or mathematical proof. I only mean in an 
informal manner that allows us to reason, similar to how applying pragma 
Pure to a package spec allows us to reason that the subprograms in such 
a package are safe for remote subprogram usage with the distributed 
annex. The public (visible) view of Pure on a package means the compiler 
of a client unit does not need to look into the implementation of the 
Pure package, since it knows the rules of pragma Pure have been applied 
to that package.

Brad
>
> If one doesn't formally describe the rules (what must and most not be
> detected), then all Ada portability is lost. In such a case, no language
> standard is needed at all (it's only real purpose is to provide an avenue
> for portability between implemetations).
>
> With Ada 2012, we provided a framework for contracts. We have to enforce
> those at runtime in the language definition because no other solution is
> practically possible. But one hopes that implementations take those further
> and provide mechanisms to use those contracts in proof settings.
>
> Certainly, future versions of Ada can add things that will provide
> additional help (exception contracts are near the top of the list, IMHO),
> but I don't think that we can do much to mandate proof. (Besides, I think
> that mandating proof would have the effect of driving all Ada vendors other
> than AdaCore out of the Ada business -- I very much doubt that any of the
> other compiler vendors could afford the investment. Perhaps that will happen
> anyway, given the slow uptake of Ada 2012 by other vendors.)
>
>                                                Randy.
>
>



  parent reply	other threads:[~2014-05-14 14:30 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02  8:42 Safety of unprotected concurrent operations on constant objects Natasha Kerensikova
2014-05-03 13:43 ` sbelmont700
2014-05-03 20:54   ` Natasha Kerensikova
2014-05-03 21:40     ` Simon Wright
2014-05-04  0:28       ` Jeffrey Carter
2014-05-04  7:46         ` Natasha Kerensikova
2014-05-04  8:06           ` Dmitry A. Kazakov
2014-05-04 15:18           ` sbelmont700
2014-05-04 15:57             ` Natasha Kerensikova
2014-05-04 18:30               ` sbelmont700
2014-05-04 19:34                 ` Dmitry A. Kazakov
2014-05-05 19:04               ` Brad Moore
2014-05-05 21:23                 ` Brad Moore
2014-05-04 21:44                   ` Shark8
2014-05-05  8:39                     ` Simon Wright
2014-05-05 15:11                       ` Brad Moore
2014-05-05 16:36                         ` Dmitry A. Kazakov
2014-05-06  6:00                           ` Brad Moore
2014-05-06  8:11                             ` Dmitry A. Kazakov
2014-05-06  8:48                               ` Alejandro R. Mosteo
2014-05-06  9:49                                 ` G.B.
2014-05-06 12:19                                   ` Dmitry A. Kazakov
2014-05-06 12:58                                     ` G.B.
2014-05-06 15:00                                       ` Dmitry A. Kazakov
2014-05-06 16:24                                         ` G.B.
2014-05-06 19:14                                           ` Dmitry A. Kazakov
2014-05-07  6:49                                             ` Georg Bauhaus
2014-05-07  7:40                                               ` Dmitry A. Kazakov
2014-05-07 11:25                                                 ` G.B.
2014-05-07 12:14                                                   ` Dmitry A. Kazakov
2014-05-07 13:45                                                     ` G.B.
2014-05-07 14:08                                                       ` Dmitry A. Kazakov
2014-05-07 17:45                                                   ` Simon Wright
2014-05-07 18:28                                                     ` Georg Bauhaus
2014-05-07  4:59                                         ` J-P. Rosen
2014-05-07  7:30                                           ` Dmitry A. Kazakov
2014-05-07  8:26                                             ` J-P. Rosen
2014-05-07  9:09                                               ` Dmitry A. Kazakov
2014-05-07 11:29                                                 ` J-P. Rosen
2014-05-07 12:36                                                   ` Safety of unprotected concurrent operations on constant objects (was: Safety of unprotected concurrent operations on constant objects) Dmitry A. Kazakov
2014-05-07 14:04                               ` Safety of unprotected concurrent operations on constant objects G.B.
2014-05-08  4:12                               ` Brad Moore
2014-05-08  8:20                                 ` Dmitry A. Kazakov
2014-05-08 10:30                                   ` G.B.
2014-05-09 13:14                                   ` Brad Moore
2014-05-09 19:00                                     ` Dmitry A. Kazakov
2014-05-10 12:30                                       ` Brad Moore
2014-05-10 20:27                                         ` Dmitry A. Kazakov
2014-05-11  6:56                                           ` Brad Moore
2014-05-11 18:01                                           ` Brad Moore
2014-05-12  8:13                                             ` Dmitry A. Kazakov
2014-05-13  4:50                                               ` Brad Moore
2014-05-13  8:56                                                 ` Dmitry A. Kazakov
2014-05-13 15:01                                                   ` Brad Moore
2014-05-13 15:38                                                     ` Brad Moore
2014-05-13 16:46                                                       ` Simon Wright
2014-05-13 19:15                                                         ` Dmitry A. Kazakov
2014-05-13 16:08                                                     ` Dmitry A. Kazakov
2014-05-13 20:27                                                       ` Randy Brukardt
2014-05-14  4:30                                                         ` Shark8
2014-05-14 21:37                                                           ` Randy Brukardt
2014-05-14 21:56                                                             ` Robert A Duff
2014-05-15  1:21                                                               ` Shark8
2014-05-14 14:30                                                         ` Brad Moore [this message]
2014-05-15  8:03                                                         ` Dmitry A. Kazakov
2014-05-15 13:21                                                           ` Robert A Duff
2014-05-15 14:27                                                             ` Dmitry A. Kazakov
2014-05-15 15:53                                                               ` Robert A Duff
2014-05-15 16:30                                                                 ` Dmitry A. Kazakov
2014-10-26 17:11                                                                   ` Jacob Sparre Andersen
2014-05-08 19:52                                 ` Randy Brukardt
2014-05-06 16:22                             ` Robert A Duff
2014-05-06 19:07                               ` Dmitry A. Kazakov
2014-05-08  5:03                                 ` Brad Moore
2014-05-08 12:03                                   ` Brad Moore
2014-05-08 19:57                                     ` Randy Brukardt
2014-05-09  2:58                                       ` Brad Moore
2014-05-05 20:29                         ` Natasha Kerensikova
2014-05-08  3:41                           ` Randy Brukardt
2014-05-08  9:07                             ` Natasha Kerensikova
2014-05-08 19:35                               ` Randy Brukardt
2014-05-08  3:12                       ` Randy Brukardt
2014-05-05 22:30                     ` Brad Moore
2014-05-04 16:04             ` Peter Chapin
2014-05-04 18:07               ` Natasha Kerensikova
2014-05-04 18:55           ` Jeffrey Carter
2014-05-04 19:36             ` Simon Wright
2014-05-04 20:29               ` Jeffrey Carter
2014-05-05 22:46             ` Brad Moore
2014-05-04 20:25           ` Shark8
2014-05-04 23:33             ` sbelmont700
2014-05-05  7:38             ` Dmitry A. Kazakov
2014-05-08  3:45               ` Randy Brukardt
2014-05-08  3:19 ` Randy Brukardt
replies disabled

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