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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a44c40a66c293f3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!proxad.net!exabot.com!freenix!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Message-ID: <45EF1E2B.2020703@obry.net> Date: Wed, 07 Mar 2007 21:18:51 +0100 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 Newsgroups: comp.lang.ada To: mailbox@dmitry-kazakov.de Subject: Re: PAR (Was: Embedded languages based on early Ada) 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> In-Reply-To: <1l5727owshrjf$.uuylbc4ek430.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 07 Mar 2007 21:18:51 CET NNTP-Posting-Host: 81.249.126.132 X-Trace: 1173298731 news.orange.fr 25937 81.249.126.132:1445 X-Complaints-To: abuse@orange.fr Xref: g2news2.google.com comp.lang.ada:9761 Date: 2007-03-07T21:18:51+01:00 List-Id: Dmitry A. Kazakov a �crit : > 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; task type Integrate is entry Run (Series : in Series_Type); entry Result (Value : in out Numeric); end Integrate; Max : constant := 30; T : array (1 .. Max) of Integrate; declare Sum : Numeric := 0.0; S : Numeric; begin for K in T'Range loop T (K).Start (Series ((K-1) * N + 1 .. K * N)); end loop; for K in S'Range loop T (K).Result (S); Sum := Sum + S; end loop; end; Typed directly from my mail client, sorry if it is not compiling :) I don't see the point of PAR which create dynamically threads all the time. A waste of time! The T tasks above can be reused during all the application lifetime if necessary. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595