CPU Affinity
CPU affinity is the practice of binding a specific process or thread to a particular CPU core, preventing the OS scheduler from moving it around. This is crucial for performance because it keeps the process's data in the CPU's local cache, significantly reducing memory access latency.
When a process jumps between cores, it loses the benefit of its cached data, forcing it to fetch from slower main memory. In trading systems, maintaining high cache locality through CPU affinity is a standard technique to ensure the fastest possible response times.
By pinning critical threads, developers ensure that their code runs with maximum efficiency and minimal overhead, which is essential for high-frequency strategies.