• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

VMware

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dears,

I have VMware for Ubuntu on my PC which is Windows 10.
I run a python script on the VMware, I specified 16GB for VMware.

The script has to calculate the maximum RAM memory percentage.

psutil.virtual_memory().percent

I know this psutil.virtual_memory() will calculate

((𝑡𝑜𝑡𝑎𝑙 𝑚𝑒𝑚𝑜𝑟𝑦 −𝑎𝑣𝑎𝑖𝑙𝑎𝑏𝑙𝑒 𝑚𝑒𝑚𝑜𝑟𝑦 )/(𝑡𝑜𝑡𝑎𝑙 𝑚𝑒𝑚𝑜𝑟𝑦 ))  ∗100

My question is that, does the total memory means 16GB ? or the whole PC total memory which is 32GB.
Please I couldn't find enough answer in the web.
 
Saloon Keeper
Posts: 26530
187
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Aminah!

Within a VM, the only memory that counts is the memory that was defined for the Virtual Machine. You should not expect to be able to tell how much RAM (physical or virtual) is available on the host (real) machine that contains the VM unless you are using a special package that escapes data flow from the VM to the host. The standard python (and Java) memory services don't do that. They can only report what's available in the VM.

Note that a VM can define itself to have more memory than the physical machine that contains it does. Although if you're not careful you can end up with serious VM page thrashing issues.
 
reply
    Bookmark Topic Watch Topic
  • New Topic