comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada 2012 automatic concurrency?
Date: Thu, 27 Dec 2012 16:13:05 -0600
Date: 2012-12-27T16:13:05-06:00	[thread overview]
Message-ID: <kbih60$rde$1@munin.nbi.dk> (raw)
In-Reply-To: kbh2m0$sou$1@online.de

"Dirk Heinrichs" <dirk.heinrichs@altum.de> 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.





  parent reply	other threads:[~2012-12-27 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25 17:26 Ada 2012 automatic concurrency? charleshixsn
2012-12-26 22:02 ` John B. Matthews
2012-12-26 22:55 ` Niklas Holsti
2012-12-27  5:57   ` charleshixsn
2012-12-27  8:59     ` Dirk Heinrichs
2012-12-27 11:22       ` Brian Drummond
2012-12-27 22:13       ` Randy Brukardt [this message]
2012-12-27 14:27     ` Jeffrey Carter
2012-12-27 20:13       ` tmoran
2012-12-27 19:06     ` Niklas Holsti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox