Elaborating Jaganathan's reply:
The header file to include is sched.h, for using
If I am right the
#define _GNU_SOURCE macro should also be defined.
cpu_set_t is a bitset where each bit represents a CPU. How the system’s CPUs are mapped to bits in the bitset is system dependent. To manipulate this bitset, to set and reset bits, a number of macros are defined:
CPU_ZERO, CPU_SET, CPU_CLR etc.
pthread_setaffinity_np, as its already understandable, sets the affinity of
thread to the
cpuset defined above using