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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm fairly new to linux (i've been experimenting since last summer but i've only been using it exclusively for about a month) and i just noticed my computer is using insanely high amounts of memory. When i first start my computer i'm only using 300~400MB out of 1024, but the longer my computer runs the higher the memory usage goes up, topping out at about 980~1000. Before i started using linux i used windoze vista rc1 and it only used somewhere around 50~55% and i thought that was crazy. Anybody know anything about this i don't? Is there any logical explanation for this? Or is my computer just completely stupid or going on strike or something? Any info would be greatly appreciated.
I only see no more than 9 or 10 processes using any memory at a time, none of which use any more than 9% at a time, but only 2 or 3 of them are doing that much. Most of them are between 0.1% and just over 1%. I have no idea where it's all going.
It's no reason to worry about. It's not amount of currently free memory that is important, it's amount of memory that can be easily freed. I mean that most of used memory is used to cache disk read results in case something needs them one (and then one more again) more time, or to buffer disk writes quickly to flush them asynchronously - while the program is running further. Run free and look in the second line. You see, I have free memory of 26MB out of 1280MB right now. No problem. I run memory hog to eat 100 MB... no problem, it eats 100MB and cache shrinks. Yes, in Windows it is possible that processes are swapping and disk cache is >150MB. I didn't see anything like that in Linux.
Oh ok. Thanks. Now I see what you mean. KSysGuard's memory meter shows a sensor for memory used by applications, buffer, and cache. That makes a lot more sense. But that makes you wonder why Superkaramba's memory meters show only the total used memory instead of giving you the option to show just the memory used by applications... It's something to think about...
It is just the different way linux deals with memory. Coming from win-world it is strange, when you're used to it, it is just what you expect.
Linux will allow things to live in memory, and until the call for more memory is issued, it just stays there. If you had a new server motherboard with literally 32 Gb of RAM, you would just see usage go up and up, until it hit about 31.8 Gb, and then it would never go any higher. As requests for RAM came in, it would drop old data out of the cache, and you'd be set.
"Linux will allow things to live in memory, and until the call for more memory is issued, it just stays there. If you had a new server motherboard with literally 32 Gb of RAM, you would just see usage go up and up, until it hit about 31.8 Gb, and then it would never go any higher."
Jim, I saw exactly what you're talking about in a previous kernel, but I'm not seeing that anymore. One of Emerson's posts pointed me at http://gentoo-wiki.com/FAQ_Linux_Mem...2.6_kernels.29 where they talk about "swappiness". I haven't played with it, but the sysctl is set to 60 on my machine.
Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.
The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.
As a sysctl, the swappiness can be set at runtime with either of the following commands:
When an application needs memory and all the RAM is fully occupied
So you still need to basically fill your RAM before swappiness would take effect. Even then, all you are influencing is if it throws out old data in RAM, or goes to the swap partition to use memory space there. Unless you are maxing out your RAM, swappiness won't have a chance to take effect. My desktop has 1 Gb of RAM, and 512 Mb of swap, and I've never seen it write to swap. My laptop however has only 256 Mb of Ram, and I live in my swap space all the time. Same deal as I mentioned earlier, like a teenage houseguest, programs don't just get up and leave memory space. Until and unless they are thrown out, they will stay there as long as possible.
Just like on a hard disk, if you put 38 Gb of data on a 40 Gb disk, then erase 4 Gb, your disk would say it has 6 Gb free, which is true, but until something writes over the 4 Gb of erased space, all of that data is still sitting there, just marked that it is actually free space, and can be overwritten. So when your 1 Gb of Ram tells you 950 Mb is used, that is true, but probably 600 or so Mb of that 950 is just cached garbage from before, and if a request came in for Ram space, it would be given up in a heartbeat.
Well, I dunno then. I've got 1GB in this machine and 2GB in the other and I rarely ever see memory usage above about 200 MB, whether I'm doing copies on large ISOs or compiling a kernel or what. Some prior kernel when I first switched from W2K, probably 2.4 used memory as you describe. I can't remember exactly when I noticed memory usage change. Swap sits mostly less than 100KB.