What is the difference between Total Physical memory and RAM ?

6,261

Solution 1

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 408

What 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.

The TotalPhysicalMemory description says:

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.

Solution 2

The 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.

Share:
6,261

Related videos on Youtube

gadhvi
Author by

gadhvi

Updated on September 18, 2022

Comments

  • gadhvi
    gadhvi almost 2 years

    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

    enter image description here

    I need to monitor RAM and other system related information like CPU so is "wmic" reliable or is there anything else which is good.

    • gadhvi
      gadhvi over 5 years
      I really can't understand why this question was down voted. We can clearly see the difference in both output.
  • Mokubai
    Mokubai over 5 years
    Saying they are not strong on math is a bit harsh as 7.88 encompasses a wide range of values when you take rounding into account. It could be anything down to 7.876 (rounded to 7.88) which would be lower than the value shown by wmic. An approximate value is good enough for that sort of display and the only way to be 100% accurate would have been to (pointlessly) show the entire value.
  • harrymc
    harrymc over 5 years
    @Mokubai: It's a fact that every method in Windows of calculating the memory gives a different result, and it's never clearly defined why. If we are to believe wmic, I get here 7.878 instead, meaning that available memory is rounded up (!) to 7.88, which is really abominable when talking about fractions of gigabytes! Better not to expect mathematical precision here. As I said, TotalPhysicalMemory at least seems minimal, but what it means is unknown.
  • Jamie Hanrahan
    Jamie Hanrahan over 5 years
    Microsoft programmers use the same "math" as everyone else (e.g. the DIV instruction in the CPU). (rolling eyes here)
  • harrymc
    harrymc over 5 years
    @JamieHanrahan: But they don't use the same API in a consistent manner. (eyes skywards and a sigh here)
  • harrymc
    harrymc over 5 years
    And rounding up memory-available figures is a mathematical error in my book.
  • Jamie Hanrahan
    Jamie Hanrahan over 5 years
    How do you know? Do you have access to the source code showing what APIs they are calling when? Or evidence that they are rounding up when they are more likely rounding-to-nearest? The wmic output here (8 458 973 184) is significantly closer to 7.88 GiB than it is to 7.87 GiB (8 450 348 154.88); "rounding to nearest" is hardly considered an "error". It may be a choice you disagree with but if your book calls that a "mathematical error" I suggest you need a new book. For that matter, why did you blithely throw away (round down) the .12 when you claimed that 7.88 GB was equal to 8 461 085 573?
  • Jamie Hanrahan
    Jamie Hanrahan over 5 years
    otoh, a completely valid criticism (IMO) of many of Windows' system performance numbers is that they use questionable and inconsistent terminology. The figure that would match the amount of RAM physically installed should be called "installed". What is being called "Total physical memory" in wmic's stats should be called "usable" - this excludes stuff like memory-mapped I/O register space that can't be used as ordinary RAM by the OS, but can be accessed by the OS for other purposes (like to control I/O devices).
  • harrymc
    harrymc over 5 years
    @gadhvi: Bravo for not being influenced by these spurious downvotes.
  • Jamie Hanrahan
    Jamie Hanrahan over 5 years
    @harrymc I don't consider a downvote for an answer that says "it's not really clear (to me) what you're getting", with an implication that nobody else can possibly know either - together with the apparently-for-some obligatory slams at Microsoft ("not very strong at math"), to be "spurious".
  • Allen Howard
    Allen Howard over 5 years
    This post is entirely wrong (and a bit hard on Microsoft). The correct answer as to why there is a discrepancy between the usable and then installed is Jamie's answer.
  • harrymc
    harrymc over 5 years
    @JamieHanrahan: I'm not interested in a fight.
  • Jamie Hanrahan
    Jamie Hanrahan over 5 years
    Neither am I. But you characterized downvotes as "spurious" and I wanted to make clear that I downvoted for a specific reason. I don't think people should "answer" questions when the answer says, essentially, "I don't really know, and nobody else knows either, but trust me, this is the best you'll get." In my book, If that's going to be your "answer", then you probably shouldn't post it as one.
  • harrymc
    harrymc over 5 years
    @JamieHanrahan: Judging by the words used, rather than by the message, is wrong. We all use words in different manner, coming from different backgrounds. At least 3 downvotes here are based on words, ignoring the fact that this answered the poster's question. I note that your answer also has criticism for Microsoft.
  • gadhvi
    gadhvi over 5 years
    Thankyou for detailed explanation.