You named this thread "CPU stats" but you are really looking at Memory stats.
total used free shared buff/cache available
Mem: 46G 39G 495M 67M 7.3G 23G
Swap: 15G 524M 15G
How is this available (23G) calculated?
If the used space is 39G, how is the free space calculated as 495M?
Total and Used are two different columns. It's not "total used", it's "total" and "used".
You have 46G total. You have 39G used (that is a little misleading, I'm coming to that part)
You have 495M shared memory between two or more applications, but that doesn't really
affect anything. You have 7.3G as buffer/cache. You have 23G available.
So then...
43
- 39
------
4
How can you have 23G available if you only have 4G left?
The kernel takes up almost all the memory you have and reserves it.
It doesn't really need it, it just grabs it if it is available. As a rule, most Linux kernels
run fine in 2G of RAM (without other applications).
So your kernel is holding onto (reserving) an extra 23G of memory it doesn't need.
When you launch other applications, the kernel will release as much as is necessary.
(It won't release all of it). If you run 2, 3 or 4 applications, it will just continue to release
as much as is needed for each application.
Of course it is possible to run so much stuff that you really do run out of available memory.
That's when swap kicks in. The only time you really use, is when real memory runs out.
Your swap shows 15G total, and 15G available.
However with 46G, it will take a LOT to run out of memory. It's not impossible, but it's difficult.
It you want to know how much memory and CPU a specific application uses, there are other tools.
"top" is probably the most common.
top - 07:44:39 up 1 day, 1:51, 2 users, load average: 0.02, 0.05, 0.00
Tasks: 413 total, 1 running, 412 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.6 id, 0.1 wa, 0.1 hi, 0.0 si, 0.0 st
MiB Mem : 32032.0 total, 24828.6 free, 5083.9 used, 2119.6 buff/cache
MiB Swap: 16084.0 total, 16084.0 free, 0.0 used. 26344.8 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2823 rmccaff+ 20 0 6167460 2.1g 1.9g S 2.7 6.6 50:32.93 VirtualBoxVM
2636 rmccaff+ 20 0 40352 11716 9424 S 0.7 0.0 2:54.41 VBoxXPCOMIPCD
1236 root 20 0 402440 14056 11528 S 0.3 0.0 3:04.97 udisksd
2191 rmccaff+ 9 -11 1095684 14728 10724 S 0.3 0.0 8:23.98 pulseaudio
2642 rmccaff+ 20 0 859260 29784 19140 S 0.3 0.1 3:56.19 VBoxSVC
3904 rmccaff+ 20 0 2103888 25100 8340 S 0.3 0.1 2:36.68 winedevice.exe
1 root 20 0 170860 13452 9504 S 0.0 0.0 0:05.30 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-kblockd
9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
10 root 20 0 0 0 0 S 0.0 0.0 0:00.16 ksoftirqd/0