[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads




The threading discussion appears to have reached a vague concensus that
threads are useful for modularizing or reducing program complexity, though
often inefficient when used for this purpose. However one working thread
per processor on an SMP system can certainly be more efficient than a
single thread or process labouring away on only one cpu. This leads to a
somewhat anticlimactic question, what is a good portable way of
determining the number of processors? I know of a Win32 API call to
achieve this, and the data can be munged out of /proc on linux I assume,
but to support an arbitrary operating system, what is The Right Thing? I
have been unable to find much libgtop documentation, is this library
suitable for determining this kind of system information? Or should the
process keep spawning threads until it notices efficiency beginning to
decrease? :)

Michael