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 X-Google-Thread: 103376,1a44c40a66c293f3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: PAR (Was: Embedded languages based on early Ada) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1172192349.419694.274670@k78g2000cwa.googlegroups.com> <1172239820.896603.222120@k78g2000cwa.googlegroups.com> <113ls6wugt43q$.cwaeexcj166j$.dlg@40tude.net> <1i3drcyut9aaw.isde6utlv6iq.dlg@40tude.net> <1c61jqeqo68w$.2irtg70stnsa.dlg@40tude.net> <1vdieyr16h7ct$.1vuvfmghy8dzo$.dlg@40tude.net> <1l5727owshrjf$.uuylbc4ek430.dlg@40tude.net> Date: Thu, 8 Mar 2007 11:06:33 +0100 Message-ID: NNTP-Posting-Date: 08 Mar 2007 11:06:33 CET NNTP-Posting-Host: dcb75f97.newsspool1.arcor-online.net X-Trace: DXC=k<;dfTN_A[IE4ZB2flKORAic==]BZ:afN4Fo<]lROoRAFl8W>\BH3YBkoF<@50ADNEDNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgBW1_`E:90VbM X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14421 Date: 2007-03-08T11:06:33+01:00 List-Id: On Wed, 07 Mar 2007 20:17:40 GMT, Ray Blaak wrote: > "Dmitry A. Kazakov" writes: >> Why is it bad programming? Consider this: >> >> declare >> Sum : Numeric := 0.0; >> begin in parallel >> Sum := Sum + Integrate (Series (1..N); >> Sum := Sum + Integrate (Series (N+1..2*N); >> Sum := Sum + Integrate (Series (2*N+1..3*N); >> ... >> end; > > This is also bad programming. The assignments are in parallel, overwriting > each other, and it is not clear in a given statement what initial value of Sum > is being worked with. That is what PAR have to define. > As shown, this example looks like it is after a sequential summation, and that > contradicts what the concurreny execution will do. No, it is a concurrent incrementing of an atomic object Sum. An equivalent should be protected type Accumulator is procedure Increment (By : Numeric); end Accumulator; >> If so, then what would be the contribution of PAR? > > A syntactic convenience to tediously writing task bodies explicitly. Consider > the immediate example above written out explicitly. In this form it barely would be convenient. > The short answer is nothing. PAR spawns some tasks and waits for them to > complete, nothing more or less. > > Parallel programing is hard. Relying on implicit optimization is what I > recommend against, since in general it is a fiendishly complex problem as to > how to sort out the interdependencies. > > Keep PAR simple, and leave it to the programmer to figure out the > synchronization. If the programmer should figure out the synchronization, then we are back where we started before fine-granularity. See Pascal's example. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de