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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Large number of tasks slows down my program (using debian) - any fix? Date: Thu, 5 Apr 2018 17:09:46 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1aa8f536-250d-4bef-9392-4d936f916e5f@googlegroups.com> <9377f941-31d0-4260-818a-8e189aac8c19@googlegroups.com> <10e74e0c-119a-4d86-8a12-c05101f744f1@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:51341 Date: 2018-04-05T17:09:46+02:00 List-Id: On 05/04/2018 16:07, Brad Moore wrote: > Another data point is the entry I submitted to the Computer Language Benchmark Games site for the Thread-Ring benchmark. > > The problem there is to create 503 tasks, and then use some sort of message passing to pass a "token" in a ring from from task to the next, 50_000_000 times, printing out the task number that ended up with the token at the end. > > I used a protected object to pass a "token" between the tasks. I believe the reason why it works as fast as it did, is that an Ada protected object can have one task perform the action of the protected object on behalf of other tasks that are queued on an entry of the protected object. That is unfair! (:-)) With protected object and same token you can "pass" it at all available cores without blocking, at once, which IMO defeats the idea of the benchmark, but shows how cool are Ada's tasking primitives. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de