Futurism lib (futures in D)
Kevin Bealer
kevinbealer at gmail.com
Wed Jan 24 12:24:20 PST 2007
== Quote from Jari-Matti_Mäkelä (jmjmak at utu.fi.invalid)'s article
> Kristian Kilpi kirjoitti:
> > BTW, is there a way to know the number of hardware threads (and maybe
> > the number of CPUs)?
>
> std.cpuid has threadsPerCPU(). See
> http://www.digitalmars.com/d/phobos/std_cpuid.html.
>
> How does one know how many hw threads there are available, if two
> multi-threaded programs are running?
My tendency would be for each program to use enough threads to utilize all the
hardware threads. This means that there will be more threads running than CPUs
exist, but I don't see extra threads as especially harmful. This is even more
true if one or the other application is sometimes idle.
For example, if a multithreaded web browser is running, it might use all the CPUs
when the user surfing, but after each page loads, the threads will all stop while
the user reads the page.
I think this is the case for most programs on a desktop machine. For server
farms, more tuning is required, and most workloads are already pretty well
optimized for the specific hardware.
(But see also the latest changes to futurism.)
Kevin
More information about the Digitalmars-d-announce
mailing list