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: Wed, 7 Mar 2007 23:45:23 -0600
Date: 2007-03-07T23:45:23-06:00	[thread overview]
Message-ID: <eso9ju$af3$2@jacob-sparre.dk> (raw)
In-Reply-To: pan.2007.03.07.20.42.03.883636@linuxchip.demon.co.uk.uk.uk

"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> wrote in message
news:pan.2007.03.07.20.42.03.883636@linuxchip.demon.co.uk.uk.uk...
...
> The contribution is the very lightweight syntax and semantics.
> One extra keyword, to permit a wide choice of implementations,
> parallel, serial, hardware, pipeline, threaded etc.
>
> PAR is ideal for the common case of running absolutely independent code!

But only if the code is guaranteed to be independent! Otherwise, all of
those different implementation techniques will give different results. And
relying on programmers to understand the many ways that this could go wrong
is not going to help any (or give this technique a good reputation, for that
matter).

If I was designing this sort of language feature, I would start with a very
strong set of restrictions known to prevent most trouble, and then would
look for additional things that could be allowed.

The starting point would be something like a parallel block:
      [declare in parallel
           declarative_part]
      begin in parallel
            sequence_of_statements;
      end in parallel;

where the declarative part could only include object declarations
initialized by parallel functions (new, see below), and the
sequence_of_statements could only be parallel procedure calls.

A parallel subprogram would be defined by the keyword parallel. They would
be like a normal Ada subprogram, except:
    * Access to global variables is prohibited, other than protected
objects, atomic objects, and objects of a declared parallel type. Note that
this also includes global storage pools!
    * Parameters are results can only be by-copy types, protected objects,
and objects of a declared parallel type.
These restrictions would be somewhat like those of a pure package, but would
be aimed at ensuring that only objects that are safe to be accessed
concurrently could be accessed. (It would still be possible to get in
trouble by having objects accessed in different orders in different
subprograms - which could matter in parallel execution - but I don't think
it is practical to prevent that. It's likely that the operations will need
to access some common data store, and rules that did not allow that could
not go anywhere.)

A "declared parallel type" would be a private type that had a pragma that
declared that all of it's operations were task-safe. (That's needed to
provide containers that could be used in parallel subprograms, for
instance.) Precisely what that would mean, I'll leave for some other time.
(It would be possible to survive without this, as you could try to use
protected objects and interfaces for everything. That sounds like a pain to
me...)

Humm, I think you'd actually need two separate blocks: "declare in parallel"
(and execute statements sequentially) and "begin in parallel" (with
sequential declarations). There seems to be a sequential (combining) stage
that follows the parallel part in most of these algorithms.

Anyway, food for thought...

                      Randy.







  reply	other threads:[~2007-03-08  5:45 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
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 [this message]
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