Soft affinity

from Wikipedia, the free encyclopedia

In the context of scheduling in operating system theory and computer science, soft affinity means that certain threads can run preferentially on certain CPUs on which they have already run before. This only helps if the CPU is free, otherwise another CPU is selected.

The advantage and purpose of this method is that there is a relatively high probability that data of the thread is still stored in the CPU context ( cache ) and that some resources can be saved with the context switch.

It should be noted here that the priority of a thread has priority over the soft affinity. (Example: Thread 1 has a soft affinity to CPU 1, CPU 2 is occupied by thread 2, thread 3 has a higher priority than thread 1, so thread 3 must be processed beforehand, then thread 1 will run again on CPU 1 or else not, although there is no soft affinity for thread 3)

See also