[J3] Feedback on 23-246: Concurrent tasks

Van Snyder van.snyder at sbcglobal.net
Fri Jan 12 23:14:01 UTC 2024


On Fri, 2024-01-12 at 12:18 +0000, Cornille, Brian via J3 wrote:
> Thought I would kick off some discussion on the Concurrent tasks
> proposal (attached for reference).

I proopsed asynchronous blocks in section 18 of 97-114r2. Having had
correspondence with the Ada committee during the last 25 years, I'm no
longer convinced this is a good idea: They rejected the idea because
they saw too many opportunities for deadlocks and race conditions. Ada
compiler vendors were unable to implement tasks without what they
considered to be excessive overhead. They added "protected variables,"
which are essentially coroutines. These are explained in "Concurrent
and Real-Time Programming in Ada" by Alan Burns and Andy Wellings.

I proposed a fork/join construct in 06-187 (and earlier papers as
well). Bill Long pointed out that this is syntactic sugar for a DO
CONCURRENT construct with a SELECT CASE construct inside of it. This
syntactic sugar would therefore be both useful, and have low
implementation cost (the front-end could convert it).

When CRITICAL blocks were being added, I urged that they ought to be
allowed within DO CONCURRENT, but the purists argued they apply only to
different images, not different threads -- even though that's what they
were originally invented for in other languages. An alternative to
CRITICAL is monitor procedures. These don't fully address the
opportunities for deadlocks or race conditions, but they do help
somewhat.

If we proceed with asynchronous blocks, critical sections and/or
monitor procedures should be on the table. And the usefulness of
coroutines for parallel programming should also be studied.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240112/0954bc3c/attachment-0001.htm>


More information about the J3 mailing list