With processor binding (also called thread affinity), the program instructs the operating system that a thread in the program should run on the same place on the machine throughout its execution, and should not be moved to other places. A place in this context refers to some grouping of sockets, cores, or hardware threads.
Processor binding can improve the performance of applications that exhibit a certain data reuse pattern where data accessed by a thread in a parallel or worksharing region will be in the local cache from a previous invocation of a parallel or worksharing region.
A computer system can be viewed as a hierarchy of sockets, cores, and hardware threads. Each socket contains one or more cores, and each core contains one or more hardware threads.
On Oracle Solaris platforms, the psrinfo(1M) command can be used to list available hardware threads. On Linux platforms, the text file /proc/cpuinfo provides information about available hardware threads.
When the operating system binds a thread to a processor, the thread will in effect be bound to a specific hardware thread or to a group of hardware threads.
To control the binding of OpenMP threads to processors, you can use the OpenMP 4.0 environment variables, OMP_PLACES and OMP_PROC_BIND. Alternatively, you can use the Oracle-specific environment variable SUNW_MP_PROCBIND. These two sets of environment variables should not be mixed. The environment variables are described in OMP_PLACES and OMP_PROC_BIND.