Playing with the CPU
The Solaris Operating System was designed to be robust and have a great focus on Resource management. So, there are many (simple and complex) tools, that provide invaluable information about the system resources, as well as powerfull tools to manage them.
One of the simple tools is “psrinfo“. The simple command: psrinfo -p, gives us the number of physical processors we have on the system. In these days where nobody knows what is virtual and what is real (no, no discussions about that Morpheus), it’s important to know how many physical processors we have, how many cores, cores/processor, etc.
using the psrinfo command with the option “-p” plus “-v”, gives us a more detailed information:
# psrinfo -pv
The physical processor has 4 virtual processors (0 2 4 6)
x86 (chipid 0x0 GenuineIntel family 6 model 15 step 11 clock 2333 MHz)
Intel(r) Xeon(r) CPU E5345 @ 2.33GHz
The physical processor has 4 virtual processors (1 3 5 7)
x86 (chipid 0x1 GenuineIntel family 6 model 15 step 11 clock 2333 MHz)
Intel(r) Xeon(r) CPU E5345 @ 2.33GHz
As you can see above, the information is very “clear”… each physical processor has “four” virtual processors, and the processor ID is showed too. As each processor can be in 4 states (online, offline, non-interruptible, or spare), we can use just the psrinfo command to have a full information about each virtual processor and its state:
# psrinfo
0 on-line since 07/10/2008 09:45:54
1 on-line since 07/10/2008 09:46:04
2 on-line since 07/10/2008 09:46:06
3 on-line since 07/10/2008 09:46:09
4 on-line since 07/10/2008 09:46:11
5 on-line since 07/10/2008 09:46:13
6 on-line since 07/10/2008 09:46:15
7 on-line since 07/10/2008 09:46:17
Another handy command is psradm wich is the one to change the processors from one state to another. The psrinfo command is for “view” the CPU configuration of the system, and the psradm is for manage that configuration. Ok, now let’s play with the cpu…
First, lets take four processors offline:
# psradm -f 4-7
# psrinfo
0 on-line since 07/10/2008 09:45:54
1 on-line since 07/10/2008 09:46:04
2 on-line since 07/10/2008 09:46:06
3 on-line since 07/10/2008 09:46:09
4 off-line since 07/10/2008 16:29:03
5 off-line since 07/10/2008 16:29:03
6 off-line since 07/10/2008 16:29:03
7 off-line since 07/10/2008 16:29:03
As you can see above, we did take offline four virtual processors (4-7), but the two physical processors are online (we have at least two virtual processors online in each physical processor). For have a whole physical processor “free”, we need to take offline the virtual processors “0 2 4 6”, or “1 3 5 7”.
Maybe you are thinking: “Why disable a processor“? Well, we work to make services available, and the hardwares are evolving (x86), to permit us to make some maintenance tasks without downtime. So, if we can isolate one or more processors, taking them offline, and the hardware permit us change a processor board with the system running, that’s great!