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.180.93.134 with SMTP id cu6mr8256135wib.5.1356837413683; Sat, 29 Dec 2012 19:16:53 -0800 (PST) MIME-Version: 1.0 Path: i11ni337233wiw.0!nntp.google.com!feeder3.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed10.multikabel.net!multikabel.net!newsfeed20.multikabel.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!news.mixmin.net!newsfeed.x-privat.org!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada 2012 automatic concurrency? Date: Thu, 27 Dec 2012 16:13:05 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1356646401 28078 69.95.181.76 (27 Dec 2012 22:13:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 27 Dec 2012 22:13:21 +0000 (UTC) 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.6157 Date: 2012-12-27T16:13:05-06:00 List-Id: "Dirk Heinrichs" wrote in message news:kbh2m0$sou$1@online.de... > 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: I think this is totally dependent on your application. My spam filter/mail gateway has about 40 tasks, and it runs on a 2000-era computer with (of course) one core. But most of these tasks are waiting on work to be posted to one of the work queues (typically, messages get processed fast enough that there is very little parallelism in practice). Most of the actual parallelism is in sending and receiving messages from the Internet, and those tasks are usually waiting on I/O to complete. OTOH, a program that has tasks doing a lot of processing surely should have much smaller numbers of tasks. Having more tasks that are running 95% of the time than the number of cores just makes them slower. As to the advice, I suspect that the +1 comes from the notion that there is at least one control tasks that runs rarely. But I think that better advice is to design the tasks so that the sum of the average utilization of the tasks (expressed as a fraction) is roughly the same as the number of cores. That is, if 4 tasks run 95% of the time, and 2 other tasks do control functions and run about 10% of the time, the total utilization is 0.95*4+0.10*2 = 4.00, so this would be a good fit on a 4 core machine. Figuring out the utilization is more work, of course, but it is a more accurate representation of the load of each task. Randy.