CPU affinity is a technique that enables the binding or unbinding of processes or threads to specific logical processors, providing greater control over multithreading execution in multiprocessor systems. You can set the affinity for processes and threads. For instance, if you want to assign a single thread to a specific processor, you can use the SetThreadAffinityMask
function. On the other hand, the SetProcessAffinityMask
function sets the affinity for all threads within a given process.