Section: Linux Programmer's Manual (3)
Return to Main Contents
get_nprocs, get_nprocs_conf - get number of processors
returns the number of processors configured by the operating system.
returns the number of processors currently available in the system.
This may be less than the number returned by
because processors may be offline (e.g., on hotpluggable systems).
As given in DESCRIPTION.
These functions are GNU extensions.
implementation of these functions is rather expensive,
since they open and parse files in the
filesystem each time they are called.
calls make use of the functions documented on this page
to return the same information.
np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
The following example shows how
can be used.
main(int argc, char *argv)
printf("This system has %d processors configured and "
"%d processors available.\n",
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
This document was created by
using the manual pages.
Time: 22:28:43 GMT, January 20, 2018