方法一:
方法一:ps -eLF 查找 PSR 字段值
[test1280@localhost 20190227]$ ps -eLFUID PID PPID LWP C NLWP SZ RSS PSR STIME TTY TIME CMDroot 1 0 1 0 1 4836 1548 2 Feb25 ? 00:00:02 /sbin/initroot 2 0 2 0 1 0 0 2 Feb25 ? 00:00:00 [kthreadd]root 3 2 3 0 1 0 0 0 Feb25 ? 00:00:00 [migration/0]……
方法二:
taskset -pc $pid
[root@VM-16-15-centos ~]# taskset -pc 21390pid 21390's current affinity list: 0,1[root@VM-16-15-centos ~]# taskset -pc 21782taskset: failed to get pid 21782's affinity: No such process
[root@VM-16-15-centos ~]# taskset -pac 22378pid 22378's current affinity list: 0,1pid 22379's current affinity list: 0pid 22380's current affinity list: 1
-c: 被设置亲和性的cpu编号
-p:查看的进程id
-a: 查看进程的所有线程