From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: =?windows-1252?Q?GNAT=A0and_Tasklets?= Date: Fri, 19 Dec 2014 21:37:00 +0100 Organization: cbb software GmbH Message-ID: <1gfkkgi7ukoj3$.1pqtchynzp9rc$.dlg@40tude.net> References: <8277a521-7317-4839-b0b6-97f8155be1a4@googlegroups.com> <9e1d2b9f-1b97-4679-8eec-5ba75f3c357c@googlegroups.com> <478c81f9-5233-4ae1-a3eb-e67c4dbd0da1@googlegroups.com> <1r2ziulc78imb$.ad6zx5upic6s$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: DnbLlTjuGCQpsiNtwqNvSg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:24160 Date: 2014-12-19T21:37:00+01:00 List-Id: On Fri, 19 Dec 2014 11:35:05 -0700, Brad Moore wrote: > I haven't listed all the semantics but for the questions you ask, > each arm of the parallel block is a separate thread of execution (which > we have been calling a tasklet). > > Each tasklet starts off with its own local declaration of Total, > initialized to 0, which is the Identity value for the reduction. > > So, for the top Total, you end up with {Top_}Total := 1 + A + B; > for the bottom Total, you end up with {Bottom_}Total := C + D; > > Then during the reduction phase, those two results get reduced using the > reduction operation, which in this case is "+". > > So the end result is Total = 1 + A + B + C + D; I think that the block should have explicit parameters, e.g. Total must be an in-out parameter of the block. The syntax should be similar to the selective accept. Each arm must also have parameters, and only those and of the block must be visible within an arm. E.g. A, B must be parameters. Nothing else should be visible. > As for exceptions, we are thinking that execution does not continue past > the parallel block until all branches have finished executing. If > exceptions are raised in multiple branches of the parallel block, then > only of those exceptions would be selected, and only that one exception > would get propagated outside the block. In this model, Exception_Occurrence should be an out-parameter. Each arm must convert exceptions to an occurrence and channel into that parameter, the reduction rule will take over and select one to propagate or ignore. If an exception is unhandled, it is Program_Error. ------------------------ As a practical example for the concept I suggest this one. A parallel block used for a spawned process. The process has the standard input pipe (to write) and the standard output and error pipes (to read out). The block has 3 arms. One writes the input, other two read the output and error. When the process completes, the block ends. If executed on a single CPU machine arms get switched one to another when get blocked on the pipe I/O. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de