Thread affinity means restricting a thread to run only on certain CPU cores. Without it, the operating system’s scheduler can move a thread from one core to another as it balances the load across the machine. The idea behind pinning a thread is cache locality: a thread that stays on one core keeps its working …
