Thread distribution on an SMP box

Carlo Sogono <[email protected]> Mon, 26 Jun 2006 13:54:44 +1000
Newsgroups gmane.linux.redhat.devel
Message-ID <[email protected]>
I would like to find out how Linux distributes processes in an 
SMP-enabled box with n CPUs. Will the kernel "move" a process from one 
CPU to another if another CPU is idle?

What I mean is...

When one of the processors become idle, will the kernel transfer an 
already started process to this idle CPU? If not, are there any ways to 
get around this (programming wise)? Say I'm going to write an 
application with 8 NPTL threads and 4 of those will only be active for a 
few minutes on a 4 CPU machine. How do I make sure that one CPU will not 
be assigned two short-lived threads?

Thanks in advance.
Carlo


-- 
Carlo Sogono