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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.209.194 with SMTP id s42mr2092233yho.42.1413484912841; Thu, 16 Oct 2014 11:41:52 -0700 (PDT) X-Received: by 10.50.134.164 with SMTP id pl4mr9957igb.0.1413484912742; Thu, 16 Oct 2014 11:41:52 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!s7no3213270qap.0!news-out.google.com!rp1ni32382igb.0!nntp.google.com!uq10no12004863igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 16 Oct 2014 11:41:51 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: dynamic vs static tasks allocation From: Adam Beneschan Injection-Date: Thu, 16 Oct 2014 18:41:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2726 X-Received-Body-CRC: 3192354402 Xref: news.eternal-september.org comp.lang.ada:22534 Date: 2014-10-16T11:41:51-07:00 List-Id: On Thursday, October 16, 2014 11:18:41 AM UTC-7, mockturtle wrote: > As a general rule, I always prefer to avoid dynamic allocation, so I pref= er to allocate the task statically. BTW, please note that if you do someth= ing like >=20 >=20 >=20 > task type Foo; >=20 > declare > Worker : Foo; -- Worker starts here > begin > -- Worker is running > ... do something ... > end; >=20 > task Worker is started "dynamically" when the execution reaches the "decl= are" block, without using "new." I do not know if your idea of "dynamicall= y" includes this example or not. Also note that in this case >=20 > procedure Bar(N: Positive) is > Workers : array (1..N) of Foo; =20 > begin > -- N workers running > ... do something; > end Bar; >=20 > the number of tasks is determined dynamically at runtime. Also note that in the above examples, the block which declares the task (in= the first example) or the procedure Bar (in the second example) will not b= e allowed to exit until the task(s) are done (technically, until they are "= terminated"). If the block or Bar uses "new" to start the task, the block = or Bar can complete while the task is still running, as long as the access = type used for "new" is not declared inside the block or Bar (technically, t= he ultimate ancestor of the access type). That may be another reason to us= e "new" to create a task. -- Adam