[lsb-discuss] LSB-compliant way to get number of processors?
Dallman, John
jgd at ugs.com
Thu Aug 3 06:42:12 PDT 2006
I'm starting on adding SMP support to the product I work on.
It uses threads to improve performance, so there's no point
in having more of them than there are processors on the
machine.
So I need to find out how many that is. Since this is a
math library, not an application, opening and parsing
/proc/cpuinfo is utterly unacceptable. I've found two ways
so far to ask Linux how many processors it has: get_nprocs()
and sysconf(_SC_NPROCESSORS_ONLN), but neither of them seem
to be allowed in LSB-compliant code.
What's the right way?
thanks,
--
John Dallman, Parasolid Porting Engineer, +44-1223-371554
More information about the lsb-discuss
mailing list