On Mon, Mar 21, 2005 at 08:27:26PM -0500, Dan Maas wrote: > Is there a canonical way for user-space software to determine how many > real CPUs are present in a system (as opposed to HyperThreaded or > otherwise virtual CPUs)? > > We have an application that for performance reasons wants to run one > process per CPU. However, on a HyperThreaded system /proc/cpuinfo > lists two CPUs, and running two processes in this case is the wrong > thing to do. (Hyperthreading ends up degrading our performance, > perhaps due to cache or bus contention).
Compare the 'physical id' fields of /proc/cpuinfo, and count how many unique values you get. Ie, on my dual+ht, I see.. physical id : 0 physical id : 0 physical id : 3 physical id : 3 Which indicates 2 real CPUs split in two. Dave - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/