Futurism lib (futures in D)
Kristian Kilpi
kjkilpi at gmail.com
Tue Jan 23 03:36:03 PST 2007
On Mon, 22 Jan 2007 03:19:53 +0200, Kevin Bealer <kevinbealer at gmail.com>
wrote:
[snip]
> I would also recommend using more thread pool threads that hardware
> threads,
> because some operations (like reading files) are IO bound, and the
> system benefits
> if it can switch to a CPU bound thread. So you always want at least the
> number of
> hardware threads, but I think its a matter of tuning how many more than
> that. If
> you think each task is about 50% CPU bound, you might want something
> like 2x the
> number of hardware threads.
Nice job! I'm looking forward to use futures in the future. :)
BTW, is there a way to know the number of hardware threads (and maybe the
number of CPUs)?
IMHO it would be good to have something like this too:
new ThreadPool(4); //pool of 4 threads
new ThreadPool(); //pool of X threads, where X is the # of hardware
threads
new ThreadPool(1.5); //pool of 1.5 * X threads (>= 1, rounded up
perhaps)
(I think one should, in general, always use thread counts relative to the
number of hardware threads.)
More information about the Digitalmars-d-announce
mailing list