comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: PAR (Was: Embedded languages based on early Ada)
Date: Mon, 5 Mar 2007 21:30:28 -0600
Date: 2007-03-05T21:30:28-06:00	[thread overview]
Message-ID: <esin5e$d8g$1@jacob-sparre.dk> (raw)
In-Reply-To: pan.2007.03.06.02.02.27.892793@linuxchip.demon.co.uk.uk.uk

"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> wrote in message
news:pan.2007.03.06.02.02.27.892793@linuxchip.demon.co.uk.uk.uk...
...
> PAR is about indicating in the source code which statement sequences
> are unordered.  The idea is to make the syntax for concurrency
> as simple as the syntax for sequentality. Perhaps using "par"
> instead of "begin" is the way to go.  Adding "all" to the for
> loop also makes a lot of sense.

My $0.02 worth:

One thing I'm absolutely certain of is that "par" would never, ever appear
in Ada. That's because Ada keywords are always complete English words
(that's true in the packages, too; abbreviations are frowned upon). I admit
that "par" *is* an English word, but it doesn't have anything to do with
parallel. So, I think the syntax would be more likely something like "begin
in parallel" or the like. (Similarly, "all" in a for loop is just too small
a keywork for such a major semantic change. I think I'd prefer "parallel" to
be used somewhere in the loop syntax; but I could be proved wrong in this
instance.)

> If you can persuade programmers to use "par" unless they explicitly
> *need* sequential execution, a great many statements will be marked
> as concurrent.  Numeric codes will use "par" in the computational
> core, as well as outer layers of execution.

Yes, and a great number of programs will have become unstable. That's
because the default in Ada is for objects that are *not* safe to access in
parallel. (That's a problem for Ada tasks, too.) Only objects with pragma
Atomic and objects wrapped in protected objects can be assumed safe.

I know you've said that you would expect programmers to worry about such
things. But that's the C way of thinking about things, and that is the root
of much of the unreliably of modern software. Programmers are likely to test
their programs on some compiler and then assume that they are correct. But
when dealing with parallel execution, nothing could be further from the
truth. The next compiler or OS will make the program execute completely
differently. The only way to "test" these things is to have tools that
enforce proper behavior (no access to global objects without
synchronization, for instance).

Of course, there is no problem with purely independent subprograms. The
problem is that hardly anything is purely independent, even most independent
algorithms depend on shared data (like a database) to guide their execution,
and if something else is changing that data, there is a lot of potential for
trouble.

...
> Mandating sequential execution except where the "pragma" is used
> puts parallel statements at an immediate disadvantage - it makes
> them seem to be second class citizens, added on afterwards
> in an attempt to speed things up. Par should be "everywhere", it's
> a *basic* component of program semantics - like a loop or a function call.
> It's absent from programming languages is because processors can't really
> take advantage of it at present, and text is inherently linear, needing no
> special "seq" directive.  Graphical languages on the other hand often
> imply concurrency automatically, and so have the opposite property. "par"
> is not a hint.
>
> Enough ranting for now...

Darn, you were just getting interesting. ;-)

$0.02 cents. Ada has the needed building blocks for parallel execution,
given that it has defined what is and is not accessible in parallel. Most
other programming languages have never thought of that, or found it too
hard, or just don't care. But you also need enforcement of safe access to
global objects (global here means anything outside of the subprograms that
were called in parallel). I don't think that that would be very practical in
Ada; the result would be pretty incompatible. (Maybe you could have
procedures defined to allow parallel execution, sort of like a pure
function, but it sounds messy. And we've never had the will to properly
define Pure functions, either, that's because we couldn't decide between the
"declared Pure and user beware" and "defined and checked Pure" approaches).

What really would make sense would be a meta-compiler, that took source code
in an Ada-like language with "begin in parallel" and other needed constructs
and converted that to regular Ada code. (Parallel calls would turn into
tasks, appropriate checking would occur, etc.). But the majority of the code
would simply get rewritten into Ada - and then an Ada compiler could compile
it. Such a system would be free of Ada compatibility concerns, but wouldn't
necessarily have to give up much of Ada's power. (And, if it caught on, the
Ada step could be dropped completely.) Clearly, the meta-compiler would have
to know something about the target (how many threads are reasonable, for
instance), but not necessarily a lot. Such a system could be a lot safer
than Ada is (well, at least until you have to make a call to C...),
especially for parallel execution.

                             Randy Brukardt.





  reply	other threads:[~2007-03-06  3:30 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23  0:59 Preferred OS, processor family for running embedded Ada? Mike Silva
2007-02-23  4:41 ` Steve
2007-02-23 16:00   ` Mike Silva
2007-02-23  4:49 ` Jeffrey R. Carter
2007-02-23 13:13   ` Mike Silva
2007-02-23 13:56 ` Stephen Leake
2007-02-23 14:10   ` Mike Silva
2007-02-24 10:45     ` Stephen Leake
2007-02-24 12:27       ` Jeffrey Creem
2007-02-24 22:10         ` Dr. Adrian Wrigley
2007-02-25 13:10           ` roderick.chapman
2007-02-25 17:53             ` Jeffrey R. Carter
2007-02-25 15:08           ` Stephen Leake
2007-02-28 17:20             ` Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster
2007-03-01  9:18               ` Jean-Pierre Rosen
2007-03-01 11:22               ` Dr. Adrian Wrigley
2007-03-01 11:47                 ` claude.simon
2007-03-01 13:57                 ` Dmitry A. Kazakov
2007-03-01 18:09                   ` Ray Blaak
2007-03-02 11:36                   ` Dr. Adrian Wrigley
2007-03-02 16:32                     ` Dmitry A. Kazakov
2007-03-03  0:00                       ` Dr. Adrian Wrigley
2007-03-03 11:00                         ` Dmitry A. Kazakov
2007-03-03 11:27                           ` Jonathan Bromley
2007-03-03 12:12                             ` Simon Farnsworth
2007-03-03 14:07                               ` Dr. Adrian Wrigley
2007-03-03 17:28                                 ` Pascal Obry
2007-03-03 18:11                                   ` Dmitry A. Kazakov
2007-03-03 18:31                                     ` Pascal Obry
2007-03-03 20:26                                       ` Dmitry A. Kazakov
2007-03-03 21:28                                   ` Dr. Adrian Wrigley
2007-03-03 22:00                                     ` Pascal Obry
2007-03-03 13:40                             ` Dr. Adrian Wrigley
2007-03-03 15:26                               ` Jonathan Bromley
2007-03-03 16:59                                 ` Dr. Adrian Wrigley
2007-03-05 15:36                               ` Colin Paul Gloster
2007-03-03  1:58                       ` Ray Blaak
2007-03-03  8:14                         ` Pascal Obry
2007-03-03 11:00                         ` Dmitry A. Kazakov
2007-03-03 21:13                           ` Ray Blaak
2007-03-05 19:01                             ` PAR (Was: Embedded languages based on early Ada) Jacob Sparre Andersen
2007-03-06  2:01                               ` Dr. Adrian Wrigley
2007-03-06  3:30                                 ` Randy Brukardt [this message]
2007-03-06  7:10                                   ` Ray Blaak
2007-03-06 18:05                                     ` Ray Blaak
2007-03-06  6:04                                 ` tmoran
2007-03-06  6:59                                 ` Ray Blaak
2007-03-06  7:07                                 ` Ray Blaak
2007-03-06  7:22                                 ` Martin Krischik
2007-03-06 13:18                                 ` Dr. Adrian Wrigley
2007-03-06 18:16                                   ` Ray Blaak
2007-03-06 23:49                                   ` Randy Brukardt
2007-03-07  8:59                                     ` Dmitry A. Kazakov
2007-03-07 18:26                                       ` Ray Blaak
2007-03-07 19:03                                         ` Dr. Adrian Wrigley
2007-03-07 19:55                                         ` Dmitry A. Kazakov
2007-03-07 20:17                                           ` Ray Blaak
2007-03-08 10:06                                             ` Dmitry A. Kazakov
2007-03-08 18:03                                               ` Ray Blaak
2007-03-07 20:18                                           ` Pascal Obry
2007-03-07 20:41                                             ` Dr. Adrian Wrigley
2007-03-08  5:45                                               ` Randy Brukardt
2007-03-08 10:06                                                 ` Dmitry A. Kazakov
2007-03-10  1:58                                                   ` Randy Brukardt
2007-03-10  9:11                                                     ` Dmitry A. Kazakov
2007-03-08 18:08                                                 ` Ray Blaak
2007-03-10  1:50                                                   ` Randy Brukardt
2007-03-05 15:23                   ` Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster
2007-03-06  0:31                     ` Dr. Adrian Wrigley
2007-03-01 16:09                 ` Colin Paul Gloster
2007-03-01 13:23               ` Martin Thompson
2007-02-26 16:34           ` Preferred OS, processor family for running embedded Ada? Jean-Pierre Rosen
2007-02-26 21:18             ` Dr. Adrian Wrigley
2007-02-27 15:39               ` Jean-Pierre Rosen
2007-02-28 12:25                 ` Jerome Hugues
2007-02-24 19:11       ` Mike Silva
2007-02-24 13:59     ` Jacob Sparre Andersen
2007-03-01 19:32       ` Jacob Sparre Andersen
2007-03-01 20:22         ` Mike Silva
replies disabled

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