With multiple CPUs, scheduling involves another decision: not only which thread runs next, but also where it should run.
Suppose a server has eight logical CPUs and twelve runnable threads. Poor placement might leave one CPU idle while another has several threads waiting. Moving a thread to the idle CPU can improve throughput, but it may also discard useful cache data or place the thread farther from the memory it uses.
Multiprocessor scheduling coordinates runnable work across several CPUs while balancing three goals:
The challenge is that load balancing and locality often pull in opposite directions.
This chapter compares global and per-CPU run queues, explains load balancing, affinity, migration costs, and topology-aware placement, and shows how to inspect CPU topology and task placement on Linux.