CPU Affinity

Turkish equivalent: CPU bağlılığıDomain: Operating Systems

A scheduler constraint that limits a process or thread to selected logical processors rather than allowing execution on the full CPU set.

What Affinity Changes

CPU affinity restricts where runnable work may execute. It can improve measurement repeatability or preserve locality in carefully designed workloads, but it does not create additional CPU capacity.

Pinning can also reduce scheduling flexibility and overload a subset of cores while others remain idle.

NUMA Interaction

On multi-socket systems, affinity should be considered together with memory placement. A thread pinned to one NUMA node can still spend much of its time accessing remote memory.

Performance Rule

Affinity is an experiment driven by evidence, not a universal optimization. Measure migrations, cache behavior, run queues and latency before and after the change.

See also NUMA and Cache Locality.