LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Total system physical memory information in linux (https://www.linuxquestions.org/questions/linux-kernel-70/total-system-physical-memory-information-in-linux-473853/)

bhavishya_goel 08-14-2006 04:25 PM

Total system physical memory information in linux
 
Hi,

I am writing a test code where by I need to check the actual physical memory on the linux system. But I am not able to find the command for that. The linux commands like free, or /proc/meminfo or dmesg | grep Memory only show the physical memory available to linux but not the ACTUAL RAM available on system.
For example, my system has 2GB of RAM and I provide only 512 MB to linux (using mem=512MB command in the grub file). So when I use any of the above commands to see the physical memory they show me 512 MB and not 2GB!

Reading mtrr contents looks like a good option but I am not very sure if it will give correct data on all the systems. Can someone help me?

w3bd3vil 08-14-2006 08:14 PM

by specifying mem=512MB in grub, your telling grub that "there is no need for you(grub) too find out the total memory, I tell you the memory is 512MB."
So, after that it doesnt bother to search for the total memory. I dont think you will be able to find the total physical ram.

why would want to restrict the mem to 512MB anyway?

bhavishya_goel 08-15-2006 01:22 PM

Quote:

Originally Posted by w3bd3vil
by specifying mem=512MB in grub, your telling grub that "there is no need for you(grub) too find out the total memory, I tell you the memory is 512MB."
So, after that it doesnt bother to search for the total memory. I dont think you will be able to find the total physical ram.

why would want to restrict the mem to 512MB anyway?

Thanks for your reply. I have got a card installed on my pci slot. The firmware running in that slot needs around 1.5 GB of system RAM to operate and thats why I have to restrict the mem to 512 MB. Can I use MTRR file contents to check the physical RAM? It gives me correct figure for physical RAM but I am not sure if it will do so for every system.


All times are GMT -5. The time now is 06:57 PM.