Search

c program in linux to find out the number of processors

The following is a C program to find out the number of processors configured on a system.
We can make use of the function sysconf and pass the argument _SC_NPROCESSORS_CONF.
We need the header file unistd.h to use sysconf.



Save the program as get_processors.c. Compile and execute the code.




Follow by Email