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: a07f3367d7,8060bed478dfa9cd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.80.199 with SMTP id t7mr6725105pax.40.1356825709001; Sat, 29 Dec 2012 16:01:49 -0800 (PST) Path: 6ni71476pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!news.mi.ras.ru!goblin3!goblin2!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Ada 2012 automatic concurrency? Date: Thu, 27 Dec 2012 11:22:02 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Date: Thu, 27 Dec 2012 11:22:02 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="dfff62e1e537b55df42008571c03e0fe"; logging-data="23372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19P51LlkVWBh1JO4EzhTkUhCVO0Cwkuqeg=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:Qa3V/6apF1j5Ls8InUDILzEyB8Q= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-12-27T11:22:02+00:00 List-Id: On Thu, 27 Dec 2012 09:59:44 +0100, Dirk Heinrichs wrote: > charleshixsn@earthlink.net wrote: > >> IIUC, there shouldn't be more than about twice as many tasks as cores. >> Is this about right? > > Hmm, taking into account that your application isn't alone on your > system and task switches have their price, too, I think you'd better go > with "# of CPUs/Cores + 1", like the Gentoo Linux Handbook suggests for > the level of parallel compilation: > > "A good choice is the number of CPUs (or CPU cores) in your system plus > one, > but this guideline isn't always perfect." [1] > > However, I'm still confused about the "+1". Probably an attempt to ensure there is always one task waiting to do useful work when a currently running task suspends. I have my doubts about the "+1" too in practice, since it may mean tasks migrating between CPUs and trashing their caches. There may be times when it is better to have "+1" per CPU, and mark each task with affinity for the CPU it starts out with. In any case, too many tasks means too much inactive state, which increases pressure on cache and slows up task swapping. So "+1" may be more of an ideal asymptotic target than a practical reality (like Colin Chapman's adage about the perfect race car - one that falls apart while crossing the finish line in first place). It would be interesting to see some numbers though. - Brian