Site Tools


thread-affinity-openmp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
thread-affinity-openmp [June 11, 2026 at 11:10] Ivan Janevskithread-affinity-openmp [June 13, 2026 at 03:13] (current) – external edit 127.0.0.1
Line 1: Line 1:
 # Thread affinity (OpenMP) # Thread affinity (OpenMP)
-On a laptop or single-socket desktop, every core reaches the same RAM at the same speed. On a multi-socket server, each socket has its own bank of RAM (NUMA, non-uniform memory access): accessing local memory is fast, but crossing the inter-socket interconnect to reach the other socket's RAM costs roughly 2–3× more. By default, the OS is free to migrate threads between cores and sockets, silently moving a thread away from the data it allocated. +On a laptop or single-socket desktop, every core reaches the same RAM at the same speed. On a multi-socket server, each socket has its own bank of RAM (NUMA, non-uniform memory access): accessing local memory is fast, but crossing the inter-socket interconnect to reach the other socket's RAM costs roughly 2–3× more. By default, the OS is free to migrate threads between cores and sockets, silently moving a thread away from the data it allocated. **Thread affinity** pins threads to specific hardware locations to prevent migration and keep threads close to their data.
- +
-**Thread affinity** pins threads to specific hardware locations to prevent migration and keep threads close to their data.+
  
 ```c ```c
thread-affinity-openmp.1781176208.txt.gz · Last modified: by Ivan Janevski