comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: PAR (Was: Embedded languages based on early Ada)
Date: Tue, 06 Mar 2007 13:18:50 GMT
Date: 2007-03-06T13:18:50+00:00	[thread overview]
Message-ID: <pan.2007.03.06.13.19.20.336128@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: pan.2007.03.06.02.02.27.892793@linuxchip.demon.co.uk.uk.uk

On Tue, 06 Mar 2007 02:01:33 +0000, Dr. Adrian Wrigley wrote:
<snip>

Thank you for your intelligent input on this.

Martin, Randy:

I chose "par" and "all" simply because that reflects Occam and the
previously suggested "for all" loop.

"parallel" would make a lot of sense:

parallel
   CookDinner;
   DoTaxReturn;
   BookHoliday;
end;

would allow execution in separate tasks, or sequential execution in
any order.

for I in Data'range parallel loop
   Transform (Data (I));
end loop;

would allow reordered or concurrent loop execution.

Ray:
> I would strongly discourage this practice. Getting sequential programs
> correct is hard enough. Parallel programs are vastly more difficult and
> subtle.

Sequential and parallel programs can easily exceed a programmer's
analyitical limits and comprehension.  Hardware designers are used to
thinking about concurrent operation.  Concurrency involving independent
operating units without communication is often straightfoward.
There is no communication to screw up - data are read in parallel and
combined serially.  This a very common and useful type.

In my opinion, "par" and "seq" were technically successful in Occam,
and many of the difficult and subtle problems are absent from the
above code because the concurrent units *cannot* address each other.
These parallel constructs are simpler and more restricted than Ada
tasks.  The point of "par" is that the restrictions eliminate concerns
over control flow.  The issue is checking for erroneous data flow
(eg accidental concurrent updates).  The compiler should warn when
this appears to be a hazard.

> It is only 2nd class because our brains our wired that way, at least in
> terms of how we know how to program.

But breaking down programs into sequential steps is a skill which
has to be learned.  So many other things have concurrency - mathematics,
physics, hardware.

> The point is to choose one way or the other, and to have the source be
> clear about that decision.

That is *almost* what I am saying.  Mark the obviously concurrent bits
as concurrent.  Mark the rest as sequential.  Assume the compiler will
choose true concurrenct execution sensibly.

tmoran:
> If programmers think of "par" as "I've carefully analyzed
> this algorithm and it may be run in parallel" that's good.  If they
> think of "par" as "I want you to run this in parallel", I think that
> would be a bad mindset.  Explicit Ada tasks are more like the latter.

precisely my point.  Writing code with "par" is a fairly simple
transition from sequential coding.  Once you've had a bit of practice,
writing robust parallel code is pretty easy, and most blocks are
clearly parallel or clearly not parallel.  You need to pay a bit more
attention to what is pure and what isn't. (much easier than tasks!)

Randy:
I'm a big fan of declaring functions as pure, and it is disappointing
to me that Ada still can't do this.  A function declared pure should
permit reordering of invocation and memoization etc.  It doesn't have
to be pure, technically (I support the "user beware" version), but
compilers should warn of impure behaviour - perhaps a pragma to
reject impurity would help.  Things like invocation counts or
debugging statements usually break the purity of a function.
I don't know how procedures should be addressed.

The meta-compiler approach is interesting, and rather like what I
suggested earlier about a new language, permiting fine-grain
concurrency, suitable for hardware and software, similar to
a rebranded/renamed Ada.

The problem with an Ada intermediate is that you can't easily translate
programs with "par" into a language without.  There is no
realistic work-around or simulation of the execution behaviour of par. 
Par says "create a thread if it looks appropriate at this moment".
The expectation is that this generates the appropriate concurrent
call instruction.  Maybe some major compiler hacking and special
directives could patch something together, like Cilk does for C.

One aspect of this discussion is the inaccessability of fine-grain
concurrency to either a harware developer or a software developer.
As a processor designer, I can see how to implement concurrent
calls and concurrent memory access - but doing this does not help
run any existing code.  As a programmer, I can see where my code
is logically concurrent, but the language denies me this expressiveness,
and my processor doesn't support it.  Some leadership is needed!

Thanks.
--
Adrian






  parent reply	other threads:[~2007-03-06 13:18 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 [this message]
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