free
[root@VM_0_16_centos ~]# free -m
total used free shared buffers cached
Mem: 996 824 172 10 32 501
-/+ buffers/cache: 289 706
Swap: 0 0 0
[root@VM_0_16_centos ~]#
Formula:
- total1 = used1 + free1 –>996=824+172
- total1 = used2 + free2 –>996=289+706
- used1 = buffers1 + cached1 + used2 –>824=32+501+289
- free2 = buffers1 + cached1 + free1 –>706=32+501+172
Here the first line is represented by 1 and the second line by 2; used1=824, used2=289
The explanation is as follows:
Code | Meaning |
---|---|
Mem | Represents physical memory statistics |
-/+ buffers/cached | Cache statistics representing physical memory |
Swap | Represents the usage of swap partitions on hard disks 0 |
total | Represents the total physical memory of 996M |
used1 | Represents the total number of buffers allocated to the cache (including buffers and caches) used (used2) +the number of caches not actually used (buffer1+cached1) |
used2 | The total amount of buffers and cache actually used is also the total amount of memory actually used. |
free1 | Unallocated memory |
free2 | The sum of unused buffers and cache and unallocated memory is the actual available memory of the system at present. |
shared | Shared memory, which is not commonly used by systems, is not discussed here. |
buffers | Number of buffers allocated but not used by the system |
cached | Number of cache s allocated but not used by the system |
- buffer
A buffer is something that has yet to be "written" to disk.
Buffer is a buffer (write bufffer) that stores data that has not yet been written to disk.
- cache
A cache is something that has been "read" from the disk and stored for later use.
Cache is something that is "read" from disk and stored for backup (read cache).
cpu information query
Top-H View Threads
cat /proc/cpuinfo
First, we should define the concepts of the number of physical CPUs, the number of cores and the number of logical CPUs.
1. Number of Physical CPUs: The number of CPUs actually inserted on the motherboard. There are several physical IDs that can be counted without duplication.
2. Number of cpu cores: The number of chipsets on a single CPU that can process data, such as dual-core, quad-core, etc.
3. Logical cpu Number: In general, Logical cpu = Number of Physical CPUs * Number of Cores per Core. If not equal, it means that the cpu of the server supports hyperthreading technology (HT: Simply speaking, it enables one core of the processor to function as two cores in the operating system. In this way, the execution resources available to the operating system are doubled, which greatly improves the overall performance of the system. At this time, the logical cpu = the number of physical CPUs x x 2 per core (processer 0-n)
2. View cpu related information by viewing/proc/cpuinfo
1. Number of physical cpu: [root@server~]# grep'Physical id'/proc/cpuinfo | sort | uniq | wc-l
2.cpu Number: [root@server~]# grep'cpu cores'/proc/cpuinfo | uniq | awk-F':'{print $2}'
3. Logical cpu: [root@server~]# cat/proc/cpuinfo | grep "processor" | wc-l
4. Whether to enable hyperthreading: [root@server~]# cat/proc/cpuinfo | grep-e "cpu cores" - e "siblings" | sort | uniq
cpu cores : 4 siblings : 4
Assuming that cpu cores==siblings means that it is not enabled
processor : 0
vendor_id : GenuineIntel
cpu famil : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5338.26
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.75
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.67
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 2
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.68
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.67
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 1
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.68
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.69
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 7
cpu MHz : 2666.766
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips : 5333.68
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
Taking this as an example, the creation file cpuinfo is analyzed as follows:
[root@server ~]# grep 'physical id' cpuinfo|sort|uniq|wc -l
2 ① #Physical cpu is 2, that is, two CPUs are plugged into the motherboard.
[root@server ~]# grep 'cpu cores' cpuinfo|uniq|awk -F ':' '{print $2}'
4 ② #The logical cpu of a single cpu is 4
[root@server ~]# cat cpuinfo| grep "processor"|wc -l
8 ③ #The total processor is 8.
[root@server ~]# cat cpuinfo| grep -e "cpu cores" -e "siblings" | sort | uniq
cpu cores : 4
siblings : 4
#cpu cores==siblings, no hyperthreading technology enabled
#So the processor above = physical cpu * single logical cpu
#That is to say, 3==2*1 is valid in this output, and multithreading technology is not enabled.
[root@server ~]#