Processes and threads normally run on any available CPU. However, they can be given an affinity to one or more CPUs, which limits them to the CPU set specified.
int
pthread_attr_setaffinity_np (pthread_attr_t *attr, size_t cpusetsize, const cpu_set_t *cpuset)
¶Sets the CPU affinity in attr. The CPU affinity controls which CPUs a thread may execute on. See Limiting execution to certain CPUs. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_setaffinity_np(3) See Linux (The Linux Kernel).
int
pthread_attr_getaffinity_np (const pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset)
¶Gets the CPU affinity settings from attr. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_getaffinity_np(3) See Linux (The Linux Kernel).
int
pthread_setaffinity_np (pthread_t *th, size_t cpusetsize, const cpu_set_t *cpuset)
¶Sets the CPU affinity for thread th. The CPU affinity controls which CPUs a thread may execute on. See Limiting execution to certain CPUs. This documentation is a stub. For additional information on this function, consult the manual page pthread_setaffinity_np(3) See Linux (The Linux Kernel).
int
pthread_getaffinity_np (const pthread_t *th, size_t cpusetsize, cpu_set_t *cpuset)
¶Gets the CPU affinity for thread th. The CPU affinity controls which CPUs a thread may execute on. See Limiting execution to certain CPUs. This documentation is a stub. For additional information on this function, consult the manual page pthread_getaffinity_np(3) See Linux (The Linux Kernel).