linux确认工作在SMP环境中



linux确认工作在SMP环境中
 
在一次troubleshooting的过程中,需要确认系统是否已经工作在SMP环境中,并查看各个cpu的负载情况,下面总结了一下方法。 www.2cto.com  
 
第一:确认安装的redhat 5.8是开启了SMP(Symmetric Multi-Processing对称多处理结构)服务的。 
[root@cepsvr1 ~]# uname -a 
Linux cepsvr1 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux 
内核标志中“SMP”,代表支持SMP 
 
第二:确认是否开启了irqbalance服务: 
该服务能够在多个CPU之间均衡分配硬件中断,能够帮助SMP系统CPU负载均衡的目的。 
 
[root@cepsvr1 ~]# service irqbalance status irqbalance (pid 30948) is running... 
通过cat /proc/interrupts能看到硬件中断信息在各个cpu上面的分配情况 
 
第三:查看(pid=4539)的这个java进程运行在哪几个cpu上面: 
[root@cepsvr1 ~]# taskset -p 4539 
pid 4539's current affinity mask: f 
[root@cepsvr1 ~]# 
 
说明: 
Cpu ID 号码,对应的16进制数为: 
Zero-based CPU ID:      7       6       5       4       3       2       1       0 
Decimal Value:        128      64      32      16       8       4       2       1 
我们的系统中cpu ID 的为(0,1,2,3), 
pid 4539's current affinity mask:f的值为cpu ID 16进制的值的和(1+2+4+8=f) 
这个说明了(pid=4539)的这个java进程工作在cpu ID 分别为0,1,2,3这个四个cpu上面的。 
 
第四:top命令查看各个cpu的使用情况: 
通过键入: 
1. top -d 1 
2.1 
可以看到各个CPU的使用情况。 
3.再键入大写的i。 
关闭top的Irix mode模式,是其工作在Solaris mode模式下,真正的SMP环境中,此模式下cpu的使用率会被除以cpu的个数。 
 
来源  http://yangyoupeng-cn-fujitsu-com.iteye.com/blog/1722514
 

相关内容

    暂无相关文章