[CentOS] tasks bouncing between CPUs

Mon Jan 29 20:42:10 UTC 2007
Florin Andrei <florin at andrei.myip.org>

I've a dual core system (see /proc/cpuinfo at the end) running CentOS 
4.4 (fully up-to-date) and I'm running a PHP script that's parsing files 
and dumping the results into a database. Software versions:

# rpm -q php
php-4.3.9-3.22
# rpm -q MySQL-server-standard
MySQL-server-standard-5.0.27-0.rhel4
# uname -srvmpio
Linux 2.6.9-42.0.3.ELsmp #1 SMP Fri Oct 6 06:21:39 CDT 2006 i686 athlon 
i386 GNU/Linux

The thing is, the script process and the MySQL process seem to 
arbitrarily jump from one CPU to another. That would be fine, I guess, 
but sometimes both processes are on the same CPU core.

Is there a way to keep these processes separate (each one on a different 
core), or make them "sticky" w.r.t. the CPU cores?



# cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 35
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 4800+
stepping        : 2
cpu MHz         : 2412.035
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext lm 
3dnowext 3dnow pni
bogomips        : 4825.57

processor       : 1
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 35
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 4800+
stepping        : 2
cpu MHz         : 2412.035
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext lm 
3dnowext 3dnow pni
bogomips        : 4821.52

-- 
Florin Andrei

http://florin.myip.org/