如果进程关联性设置为禁用的处理器,那么进程会发生什么情况?

如果进程关联性设置为禁用的处理器,那么进程会发生什么情况?

我在一台具有 40 个核心和 80 个线程的超线程 Ivy Bridge 机器上运行 Centos7。

以下 for 循环显示了 pid <= 80 的所有进程的处理器关联性:

for pid in $(ps -e -o pid=); do  if ((pid<=80))  ;   then   taskset -pc $pid  ;  fi; done

当所有虚拟处理器均启用时,其输出为

pid 1's current affinity list: 0-79
pid 2's current affinity list: 0-79
pid 4's current affinity list: 0
pid 6's current affinity list: 0
pid 7's current affinity list: 0
pid 8's current affinity list: 0-79
pid 9's current affinity list: 0-79
pid 10's current affinity list: 0-79
pid 11's current affinity list: 0
pid 12's current affinity list: 1
pid 13's current affinity list: 1
pid 14's current affinity list: 1
pid 16's current affinity list: 1
pid 18's current affinity list: 2
pid 19's current affinity list: 2
pid 20's current affinity list: 2
pid 22's current affinity list: 2
pid 24's current affinity list: 3
pid 25's current affinity list: 3
pid 26's current affinity list: 3
pid 28's current affinity list: 3
pid 30's current affinity list: 4
pid 31's current affinity list: 4
pid 32's current affinity list: 4
pid 34's current affinity list: 4
pid 36's current affinity list: 5
pid 37's current affinity list: 5
pid 38's current affinity list: 5
pid 40's current affinity list: 5
pid 41's current affinity list: 6
pid 42's current affinity list: 6
pid 43's current affinity list: 6
pid 45's current affinity list: 6
pid 46's current affinity list: 7
pid 47's current affinity list: 7
pid 48's current affinity list: 7
pid 50's current affinity list: 7
pid 51's current affinity list: 8
pid 52's current affinity list: 8
pid 53's current affinity list: 8
pid 54's current affinity list: 8
pid 55's current affinity list: 8
pid 56's current affinity list: 9
pid 57's current affinity list: 9
pid 58's current affinity list: 9
pid 60's current affinity list: 9
pid 61's current affinity list: 10
pid 62's current affinity list: 10
pid 63's current affinity list: 10
pid 65's current affinity list: 10
pid 66's current affinity list: 11
pid 67's current affinity list: 11
pid 68's current affinity list: 11
pid 70's current affinity list: 11
pid 71's current affinity list: 12
pid 72's current affinity list: 12
pid 73's current affinity list: 12
pid 74's current affinity list: 12
pid 75's current affinity list: 12
pid 76's current affinity list: 13
pid 77's current affinity list: 13
pid 78's current affinity list: 13
pid 80's current affinity list: 13

由于某种原因,Linux 决定将许多系统进程的处理器关联设置为特定处理器。特别是对于 pid 介于 66 和 80 之间的进程,处理器关联性设置为处理器 11、12 或 13。

现在,我禁用处理器 ID > 10 的所有虚拟处理器,然后重新运行 for 循环。结果如下:

pid 1's current affinity list: 0-9
pid 2's current affinity list: 0-9
pid 4's current affinity list: 0
pid 6's current affinity list: 0
pid 7's current affinity list: 0
pid 8's current affinity list: 0-9
pid 9's current affinity list: 0-9
pid 10's current affinity list: 0-9
pid 11's current affinity list: 0
pid 12's current affinity list: 1
pid 13's current affinity list: 1
pid 14's current affinity list: 1
pid 16's current affinity list: 1
pid 18's current affinity list: 2
pid 19's current affinity list: 2
pid 20's current affinity list: 2
pid 22's current affinity list: 2
pid 24's current affinity list: 3
pid 25's current affinity list: 3
pid 26's current affinity list: 3
pid 28's current affinity list: 3
pid 30's current affinity list: 4
pid 31's current affinity list: 4
pid 32's current affinity list: 4
pid 34's current affinity list: 4
pid 36's current affinity list: 5
pid 37's current affinity list: 5
pid 38's current affinity list: 5
pid 40's current affinity list: 5
pid 41's current affinity list: 6
pid 42's current affinity list: 6
pid 43's current affinity list: 6
pid 45's current affinity list: 6
pid 46's current affinity list: 7
pid 47's current affinity list: 7
pid 48's current affinity list: 7
pid 50's current affinity list: 7
pid 51's current affinity list: 8
pid 52's current affinity list: 8
pid 53's current affinity list: 8
pid 54's current affinity list: 8
pid 55's current affinity list: 8
pid 56's current affinity list: 9
pid 57's current affinity list: 9
pid 58's current affinity list: 9
pid 60's current affinity list: 9
pid 61's current affinity list: 
pid 62's current affinity list: 
pid 63's current affinity list: 
pid 65's current affinity list: 
pid 66's current affinity list: 
pid 67's current affinity list: 
pid 68's current affinity list: 
pid 70's current affinity list: 
pid 71's current affinity list: 
pid 72's current affinity list: 
pid 73's current affinity list: 
pid 74's current affinity list: 
pid 75's current affinity list: 
pid 76's current affinity list: 
pid 77's current affinity list: 
pid 78's current affinity list: 
pid 80's current affinity list: 

pid = 1 的进程的亲和力现在显示为 0-9,而不是 0-79。这正是我所期望的。但是,pid 介于 66 和 80 之间的进程显示没有关联列表。这是否意味着他们的亲和力列表是 0-9,还是其他什么?系统似乎工作得很好,所以这些没有亲和力的进程一定在做他们的工作。

当然,还有许多其他进程的原始亲和性设置为已被禁用的处理器。我没有显示近 1000 行输出,而是仅显示了前 80 个进程的结果。

相关内容