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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Large number of tasks slows down my program (using debian) - any fix? Date: Fri, 30 Mar 2018 19:09:49 -0500 Organization: JSA Research & Innovation Message-ID: References: <1aa8f536-250d-4bef-9392-4d936f916e5f@googlegroups.com><9377f941-31d0-4260-818a-8e189aac8c19@googlegroups.com> <87h8ox1ect.fsf@nightsong.com> Injection-Date: Sat, 31 Mar 2018 00:09:50 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="8491"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:51258 Date: 2018-03-30T19:09:49-05:00 List-Id: "Paul Rubin" wrote in message news:87h8ox1ect.fsf@nightsong.com... > "Dmitry A. Kazakov" writes: ... >> ... Assuming the time quant is 10ms...: 10 x 500 / 4 = 1.25s [+125ms] >> is the time a task gets back to a core. 1.3s is an eternity. > > Sure, if all 500 tasks are cpu-busy then things are in a dreadful state, > but usually the reason to use so many tasks is concurrent i/o, i.e. most > of the threads are blocked awaiting input. If you know what you are doing, surely. Since the OP was experimenting, who knows? Assuming that you don't want to wait for your favorite compiler to implement Ada 2020 (probably a few years yet, we have to figure out what Ada 2020 is first ;-), my recommendation for parallel execution is to use Brad Moore's Paraffin libraries. They take care of things like load balancing and chunking to make good use out of your CPU resources. One can't do that just by launching one task per iteration for the reasons outlined above. Randy.