> > Most SMP machines (better their operating systems) move processes
> > between the CPUs at will.
> Is this true? I can imagine proceses and threads are dynamically
> assigned to CPUs in an intelligent way on creation but reassigning them
> to a different CPU during their lifetime?
Yes, a process can migrate between processors at any time in Linux.
Imagine, you create 4 tasks, and they are allocated
initially on 2 processors, 2 tasks per CPU. The 2 tasks on CPU 0 finish
quickly and the 2 others on CPU 1 are still running. It's a good thing
that one of the 2 remaining tasks migrate from CPU 1 to CPU 0 if CPU 0
A such mechanism is also usefull to keep the processors busy when processes
or threads are blocked in I/O.
The scheduler tries to keep a task on the same CPU, to maximize the
cache hits on L1, but sometimes a migration is just more efficient.