可以使用top命令查看一个进程的各个线程分别run在哪个processor上
在默认配置下不显示线程信息,需要进入Top后按shift+H,打开线程显示。
另外,如果没有P列,还需要按“f”,按“j”,添加,这一列显示的数字就是这个线程上次run的processor id。

关于top的使用,请读者自行man top

Tasks: 415 total,   2 running, 413 sleeping,   0 stopped,   0 zombieCpu(s):  3.9%us,  0.4%sy,  0.0%ni, 95.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%stMem:  65956144k total, 56428456k used,  9527688k free,   321292k buffersSwap:  8388600k total,        0k used,  8388600k free, 49813252k cached  
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+   P COMMAND 
31813 root      20   0  108m 1952 1512 R 100.0  0.0   0:56.77  0 bash
    1 root      20   0 19364 1536 1228 S  0.0  0.0   0:01.46  4 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.02 12 kthreadd 
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.47  0 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:38.84  0 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  0 migration/0
    6 root      RT   0     0    0    0 S  0.0  0.0   0:00.53  0 watchdog/0 
    7 root      RT   0     0    0    0 S  0.0  0.0   0:02.52  1 migration/1
    8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  1 migration/1
    9 root      20   0     0    0    0 S  0.0  0.0   0:10.65  1 ksoftirqd/1
   10 root      RT   0     0    0    0 S  0.0  0.0   0:00.44  1 watchdog/1 
   11 root      RT   0     0    0    0 S  0.0  0.0   2:11.82  2 migration/2
   12 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  2 migration/2
   13 root      20   0     0    0    0 S  0.0  0.0   0:41.18  2 ksoftirqd/2
   14 root      RT   0     0    0    0 S  0.0  0.0   0:00.41  2 watchdog/2 
   15 root      RT   0     0    0    0 S  0.0  0.0   2:13.20  3 migration/3 
   16 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  3 migration/3
   17 root      20   0     0    0    0 S  0.0  0.0   0:02.46  3 ksoftirqd/3
   18 root      RT   0     0    0    0 S  0.0  0.0   0:00.36  3 watchdog/3 
   19 root      RT   0     0    0    0 S  0.0  0.0   0:00.68  4 migration/4
   20 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  4 migration/4  
   21 root      20   0     0    0    0 S  0.0  0.0  16:39.85  4 ksoftirqd/4 
   22 root      RT   0     0    0    0 S  0.0  0.0   0:00.43  4 watchdog/4  
   23 root      RT   0     0    0    0 S  0.0  0.0   0:00.85  5 migration/5 
   24 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  5 migration/5  
   25 root      20   0     0    0    0 S  0.0  0.0   0:02.72  5 ksoftirqd/5  
   26 root      RT   0     0    0    0 S  0.0  0.0   0:00.39  5 watchdog/5  
   27 root      RT   0     0    0    0 S  0.0  0.0   0:00.01  6 migration/6 
   28 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  6 migration/6  
   29 root      20   0     0    0    0 S  0.0  0.0   0:10.45  6 ksoftirqd/6 
   30 root      RT   0     0    0    0 S  0.0  0.0   0:00.35  6 watchdog/6  
   31 root      RT   0     0    0    0 S  0.0  0.0   0:00.06  7 migration/7 
   32 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  7 migration/7 
   33 root      20   0     0    0    0 S  0.0  0.0   0:01.37  7 ksoftirqd/7 
   34 root      RT   0     0    0    0 S  0.0  0.0   0:00.40  7 watchdog/7 
   35 root      RT   0     0    0    0 S  0.0  0.0   0:00.02  8 migration/8 
   36 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  8 migration/8 
   37 root      20   0     0    0    0 S  0.0  0.0   0:00.62  8 ksoftirqd/8 
   38 root      RT   0     0    0    0 S  0.0  0.0   0:00.34  8 watchdog/8
   39 root      RT   0     0    0    0 S  0.0  0.0   0:00.08  9 migration/9
   40 root      RT   0     0    0    0 S  0.0  0.0   0:00.00  9 migration/9
   41 root      20   0     0    0    0 S  0.0  0.0   0:00.49  9 ksoftirqd/9
   42 root      RT   0     0    0    0 S  0.0  0.0   0:00.38  9 watchdog/9