CPUaffinitet
CPU affinity, also known as processor affinity or CPU pinning, is a scheduling feature that binds a process or thread to a specific subset of CPUs. In Danish, the term is CPUaffinitet. The binding is implemented by a mask or list of CPUs that the task is allowed to run on. If a task has affinity set, the system scheduler will not migrate it to CPUs outside the allowed set (except in some fault or emergency situations).
Purpose and effects: Affinity can improve performance by increasing cache locality and reducing cross-core traffic, as
Implementation: Operating systems expose different interfaces. Linux provides sched_setaffinity and sched_getaffinity, and the command line tool
Typical use cases: high-performance computing, database servers, media encoding, and real-time applications are common scenarios for
Caveats: Affinity policies can become complex to manage, may hinder dynamic load balancing, and reduce portability