Suppose each thread's affinity is all the processors. Whenever a thread becomes ready, will the kernel attempt to find an idle processor to run it?

  • If the process hasn't an affinity set to a specific core, then the scheduler will make it available to run on any available core, as soon as its logic says so (task priority, etc). – fduff Jul 21 '16 at 6:46

The kernel's process scheduler does not wait for cores to become idle, it actually decides what gets processing slices on each core sequentially based on affinity and priority.

When the thread is sleeping or waiting on I/O, it will simply get skipped until the next time the scheduler loops back to it in its processing queue.

Understanding this in more details requires reading the source code. Be warned that it is the most complex part of the kernel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.