Inconsistencies between top and free
Noticed a few discrepancies in the reports generated on my VPS:
Total Used Free top command 262 132 129 free command 256 129 126 Not sure why but the top command gives an extra 3MB for both used and free memory. Also, notice that there are a total of 29 rows of information returned by the top command for the httpd process. Each row indicates they took an average of 3.5-3.6%. Well, 29 * 3.5 = 101.5%. How can this be possible for two things: 1) The number greater than 100%. 2) The number doesn't correlate with the memory usage details returned by the top and free commands. Puzzled..... Code:
top - 17:44:47 up 14 days, 6:53, 1 user, load average: 26.94, 10.80, 4.40 |
The output of top is very hard to read. Please post the output of commands in [CODE] tags for easier reading. It's the # toolbar button after you click 'Go Advanced'.
|
Be better if you provide more detail on what you did. Let me guess you just dropped the last 3 digits from the top numbers - try dividing them by 1024 and see what happens.
Understanding kilo/mega/kibi/mebi-byte would be essential to reporting memory. Wikipedia has a good article. Memory usage reported by top includes shared libraries. Correct memory accounting is non-trivial. |
Wow it is indeed due to the 1024 vs 1000 issue. Thanks.
As for why the httpd process's memory% added up to more than 100% vs what both the top and free command indicates to have been consumed, any idea? Both top and free indicates that there are almost 50% memory left. But httpd indicated by top suggests that the httpd alone has already taken all memory? Puzzled. |
Quote:
What %MEM indiacates ? It indicates the task’s currently used share of available physical memory. Means suppose your MEM is 100 MB and the first task is taking 5% of memory .Now the available memory is 95 MB .Now anothe task is taking 5% ,i.e. not 5% of 100 MB but 5% available memory that is of 95 MB = 4.75 MB . Now calculate and post , how your memory usage is above 100% ? |
Quote:
Can you kindly let me know how did you come to know about this? You must have some great references. Nevertheless, this is some messed up way of displaying what memory usage a process is consuming. Why would anyone be interested in knowing how much remaining memory was used? The information can be rather unworthy. Afterall, how do we know in which sequence is the memory calculated. |
I doubt that explanation - top just reads the various entries in /proc.
As I said, the memory reported for each process is not just that processes usage. Have a read of this - it discusses "ps", but is equally applicable to "top". |
Quote:
We dont have to bother about the sequence, its the work of OS , which task to start first and assign memory according to the need of that process . You can get them by sequence of PID . |
syg00, true guru! I wonder if the same is true on what's reported by Task Manager or WMI in Windows.
|
Quote:
|
Quote:
Quote:
Quote:
|
Quote:
Just out of curiosity, does Solaris have an implementation of the WBEM service like the Windows WMI? I've been using Solaris 5.8 and 5.10 but have never seen any WMI like feature whether through command line or GUI. Well we don't use GUI... just putty. But also not awared of such thing being available via CLI. Is there such thing available? |
Yeah,above discussion is correct about psas it displays total memory used by a process which includes shared libraries loaded in memory,which are simultaneously used by other processes too!
|
All times are GMT -5. The time now is 03:47 PM. |