I recently wrote some code that wants to know how many cores or processors there are in the Linux system, so it can estimate how many parallel threads it makes sense to set up. I did this by scanning "/proc/cpuinfo". Is this now in danger of breaking at any time, because it relies on "something the kernel exports other than syscalls?"
In that case I would like to know of some alternate, more stable way to get this information - and preferably without adding dependencies on some heavy-duty libraries or middleware, since the program currently depends on nothing but its own code, the standard C library, and pthreads.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds