I believed both terminologies represent same thing however I see different values and makes me wonder is Total Physical Memory = RAM + something ?
Total Physical Memory output using- "wmic ComputerSystem get TotalPhysicalMemory" 8458973184
RAM information from Windows System Page
I need to monitor RAM and other system related information like CPU so is "wmic" reliable or is there anything else which is good.
12 Answers
Microsoft programmers are not very strong on math:
8 GB = 8 589 934 592
7.88 GB = 8 461 085 573
TotalPhysicalMemory = 8 458 973 184
8 GB - TotalPhysicalMemory = 8589934592 - 8458973184 = 130 961 408What we see here is that the Microsoft programmer that issued the 7.88 GB figure rounded it up, thereby creating about 130 MB of memory that simply does not exist, because this is a fraction of a very large number, the gigabyte. It would have been more correct to round it down, which would be safer for calculations and better mathematics, or even to add more decimal places which would have reduced the rounding error.
You could run the command systeminfo | findstr Memory to get even more numbers.
TheTotalPhysicalMemory descriptionsays:
Total size of physical memory. Be aware that, under some circumstances, this property may not return an accurate value for the physical memory. For example, it is not accurate if the BIOS is using some of the physical memory. For an accurate value, use the Capacity property in Win32_PhysicalMemory instead.
So you may use wmic, but it's really unclear what you are getting. At least, TotalPhysicalMemory seems to be the smallest number among all those that I found, so it might be safe to use.
13The WMIC counter "TotalPhysicalMemory" is the subset of the installed RAM that is usable by Windows as ordinary RAM. In other words, this is the number against which you should evaluate numbers like the working set of a process. It is also one contributor to the system commit limit (the other being the current pagefile size).
It excludes what Task Manager calls "hardware reserved". This is mostly RAM that cannot be accessed because its addresses conflict with those of firmware, of "register space" defined by I/O devices, and similar. That is the reason for most of the discrepancy between the 8 GiB you bought and installed vs. WMIC's reported "Total".
Since in your comment you mentioned "free", I should mention that the WMIC counter Win32_operatingsystem.FreePhysicalMemory corresponds to Task Manager's "Available" display. This is the amount of RAM that is immediately available for use to satisfy hard page faults for new allocations, without taking it from a process that's using it and without having to copy any old contents out to e.g. a pagefile or a mapped file first. It is the sum of what Resource Monitor shows as "Standby" and "Free". (Yes, their terminology is inconsistent - I would say inexcusably so.)
You can get the amount "used" simply by subtracting Win32_operatingsystem.FreePhysicalMemory from Win32_computersystem.TotalPhysicalMemory.
1