Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am new to Linux, and here is a dumb question:
How can I see the memory taken by each process?
Why this question:
I have a server (CentOS 5.8), its total memory is 32 GB, and now the used memory is more than 31 GB, so I want to get which process takes most memory.
Meantime, if I can see all of the memory taken for every process, that would be best!
You are not seeing any process taking all that ram because actually there isn't one. You ram is just being cached by the linux kernel but is going to be freed if needed.
You are using very low ram on that server.
You are not seeing any process taking all that ram because actually there isn't one. You ram is just being cached by the linux kernel but is going to be freed if needed.
You are using very low ram on that server.
Hi Celyr,
Thanks A Lot for your quick reply!
You mean the linux kernel cached lots of RAM? And how can I know how much RAM it cached?
Let's say the output of "free -m", the first line:
Code:
--------------------------------------------
total used free shared buffers cached
Mem: 32108 31579 528 0 6 43
--------------------------------------------
Does not it mean that only 43 mb are being cached (by kernel)? If not, how to understand the value for "cached 43"?
Thank you very much!
Last edited by liuwenbin168@126.com; 09-14-2012 at 03:19 AM.
@liuwenbin168@126.com, in future use [code] tags as @Celyr has - it retains data formatting and makes it easier (and more likely) others will try to help.
As for your problem, RAM gets used for all sorts of things by the kernel and products (like Oracle e.g.).
Lets see the output from
[root@ID5xinyong ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 117036 537856 7992 45012 243 61 253 67 0 0 3 1 87 9 0
----------------------------------------------------
Yes, it looks like my server is doing I/O frequently, but sorry, I am not running any special programs on it.
As the value of : swap in/out, data is being swapped in and swapped out quickly, is it also meaning that there is some fishy process?
Last edited by liuwenbin168@126.com; 09-14-2012 at 03:15 AM.
@liuwenbin168@126.com, in future use [code] tags as @Celyr has - it retains data formatting and makes it easier (and more likely) others will try to help.
As for your problem, RAM gets used for all sorts of things by the kernel and products (like Oracle e.g.).
Lets see the output from
Code:
cat /proc/meminfo
. Use code tags or else you may get ignored.
Thank you, syg00, I will be happy to follow the rule of our forum.
Much more readable.
It is not a rule - merely common courtesy. If you want people to read your posts, make it easy for them to help you.
You have almost 7 Gig reserved for huge pages - which aren't (currently) being used. They can be disabled (at boot), but we can't know if that will affect whatever you are running on that system. Google should help.
Personally I'd be inclined to turn it off and see what happens - but it's not my system.
Much more readable.
It is not a rule - merely common courtesy. If you want people to read your posts, make it easy for them to help you.
You have almost 7 Gig reserved for huge pages - which aren't (currently) being used. They can be disabled (at boot), but we can't know if that will affect whatever you are running on that system. Google should help.
Personally I'd be inclined to turn it off and see what happens - but it's not my system.
Hi syg00, Thanks Very Much for pointing out my problem, my RAM issue is probably caused by huge page configuration.
Yes, my system performance slow down when I configured huge pages for it.
I need to learn more knowledge on Huge Pages then I think I will be clear on this problem.
Is there anything special we can get from these prints?
Thanks a lot!!
I can't get anything sorry, but the situation keeps looking wired to me. The only think that I can suggest to you is to keep investigating and to lower down the number of huge pages
Code:
echo number > /proc/sys/vm/nr_hugepages
Where number can be even 10 since you are not using them at all
How many processes are you running ?
Code:
ps aux | wc -l
As you may have seen i have modified the post because ramfs doesn't get printed on df -h, try to see if you have ramfs mounted
I can't get anything sorry, but the situation keeps looking wired to me. The only think that I can suggest to you is to keep investigating and to lower down the number of huge pages
Code:
echo number > /proc/sys/vm/nr_hugepages
Where number can be even 10 since you are not using them at all
How many processes are you running ?
Code:
ps aux | wc -l
As you may have seen i have modified the post because ramfs doesn't get printed on df -h, try to see if you have ramfs mounted
Code:
mount | grep ramfs
Hi Celyr,
Since I have finished work and I am at home now, I cannot run the commands you provided right now, but I will do it on Monday, and then post the prints here.
I do THANKS A MILLION for you teacher's great patience! You're really a nice man, thanks and have a nice weekend please!
Last edited by liuwenbin168@126.com; 09-16-2012 at 08:01 PM.
I can't get anything sorry, but the situation keeps looking wired to me. The only think that I can suggest to you is to keep investigating and to lower down the number of huge pages
Code:
echo number > /proc/sys/vm/nr_hugepages
Where number can be even 10 since you are not using them at all
How many processes are you running ?
Code:
ps aux | wc -l
As you may have seen i have modified the post because ramfs doesn't get printed on df -h, try to see if you have ramfs mounted
Code:
mount | grep ramfs
Hi Celyr,
Code:
[root@ID5xinyong ~]# echo number > /proc/sys/vm/nr_hugepages
<This is what I got:> -bash: echo: write error: Invalid argument
and FYI:
[root@ID5xinyong ~]# cat /proc/sys/vm/nr_hugepages
3488
Code:
[root@ID5xinyong ~]# ps aux | wc -l
352
Too many processes are running. May I know how many processes are there in common? Thanks!
"mount | grep ramfs" still returns nothing.
Code:
[root@ID5xinyong ~]# mount | grep ramfs
[root@ID5xinyong ~]#
What else I can do to clarify my issue?
Last edited by liuwenbin168@126.com; 09-16-2012 at 08:30 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.