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: Fri, 30 Mar 2018 11:04:14 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1aa8f536-250d-4bef-9392-4d936f916e5f@googlegroups.com> <9377f941-31d0-4260-818a-8e189aac8c19@googlegroups.com> NNTP-Posting-Host: kQkuQcRDy1QFvWpyB1foYw.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 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:51254 Date: 2018-03-30T11:04:14+02:00 List-Id: On 2018-03-30 00:33, Shark8 wrote: > Hm, you shouldn't be hitting the limit with so few tasks. (500 sounds like a lot, but most OSes you'll be using use an integer-ID; meaning something on the order of 2**32 or 2**64.) It is a simple calculation. Assuming a context switch were around 1000ns. x 500 tasks / 4 cores = 125ms if all tasks are busy. 125ms is a long time. Another factor is scheduling. Assuming the time quant is 10ms (Windows default) and all task are doing pure calculations uninterrupted by any I/O, then, again: 10 x 500 / 4 = 1.25s [+125ms] is the time a task gets back to a core. 1.3s is an eternity. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de