Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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 know its a good thing that my swap is not being used...i have 1GB DDR ram...but i was curious why the swap space is being left untouched when the free ram drops down to even 10MB....im sure my swap space is active...
and another related questions..is there anyway to purge the used ram?(something like those winblows memory managers like free ram xp pro)....is it even needed?
So I've actually dipped into swap, which almost never happens, but looking at the buffers/cache line shows I'm using more non-buffer memory, with less total RAM, and I've still only just gotten to swap. Plus, that fluctuates. You may have a surge that pushes you to swap and, after it drops, you might still have some swap used. So, in sum, I don't see a problem there. There'd be a problem only if swap said 0 0 0.
As far as purging, seems like there should be, but I can't think of it. sync brings the filesystem data up to date, but I dunno about RAM. But, no, in general, it shouldn't be necessary. Maybe somebody will post up with that.
Originally posted by ganja_guru i know its a good thing that my swap is not being used...i have 1GB DDR ram...but i was curious why the swap space is being left untouched when the free ram drops down to even 10MB....im sure my swap space is active...
and another related questions..is there anyway to purge the used ram?(something like those winblows memory managers like free ram xp pro)....is it even needed?
hey have u compiled u r own kernel and if yes then are u sure u have kept the swap support there in ur kernel
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315
Rep:
unless you have a lot of processes and services using all the memory there is NO reason why it will get used.
with 1G ram it's likely you don't don't have a reason to use swap.
I remember days when 1G would be the total "disk capacity" on a whole bunch of machines with 10's of users :-))
Yeah - I've still got a box with a smaller hard drive than his RAM. Huh. As a matter of fact, about half the boxes I've ever owned would fall in that class.
Well, there's no problem. His swap is initialized and he's not maxed on physical memory, so it simply won't get used because it doesn't need to. But if it was needed, I'm sure it would be used. Like I say, it'd only be a concern if swap read zeros all the way across or he *was* maxed out on physical RAM and still wasn't swapping.
masand: yes i have compiled thelatest 2.6.10cko kernel, with the con kolivs patch to use 'high memory off(for 1GB machines),and swap is definetly on
well the free -m i posted was only a random instance...the point is i have my box running for days..and ive NEVER EVER seen swap being used...even when i had 512 MB DDR ram...thats what worries me...
oh and i know that when apps are executed once they get loaded into the memory...so technically my startup of apps should be faster...and they are, but only for a little while...but..
let me illustrate.
1. open firefox (5 seconds)
2. close firefox.
3. open firefox again (1-2 seconds)
but, if i do this:
1. open firefox
2. close firefox
3. open Open office
4. open xmms
5. blah blah
6 open firefox again(now its slower than the previous time...i.e more that the ususal 1-2 seconds )
my biggest problems occur when i copy huge files from vfat to reiserfs/4...thats slows everything to a crawl and maxes out ram usage...but swap is never used even then..
100% memory use -is- a good thing. (Because 75% of that is usually just buffers/cache)
Using swap slows things down roughly 1000% (yes, that's 4 zeros).
There are 4 types of memory: User, Shared, Buffers, and Cache. Buffers and Cache can be considered 'free' memory, they exist only until a 'real' application needs some memory that they occupy, then Linux just re-assigns that memory to that application. These buffers and cache improve the performance of your system, because reading data from physical memory is anywhere from 100-1000 times faster than reading it from disk (swap). Linux stores data in these buffers and cache that it may need again later. (Buffers and cache never hurt you. Having alot of User and Shared memory is what you need to worry about.)
But, you have to realize that there is no benefit from storing these in swap, because the data in these buffers and cache is stored on the disk somewhere already.
Quote:
1. open firefox
2. close firefox
3. open Open office
4. open xmms
5. blah blah
6 open firefox again(now its slower than the previous time...i.e more that the ususal 1-2 seconds )
That is exactly how it should be. Like I said earlier, Linux dumps the buffers and cache when other programs need that memory. So if you -try- to use up all your memory, Linux will dump the cached copies of firefox. What you need to understand is that even if Linux put that cache in swap, it would be no faster than loading firefox directly from disk. Either way it loads off of the disk. There's no point in having two copies of the same thing on disk.
Quote:
my biggest problems occur when i copy huge files from vfat to reiserfs/4...thats slows everything to a crawl and maxes out ram usage...but swap is never used even then..
Swap is generally only used when you try to use more memory than you actually have. When you copy large files, Linux does caching to improve the performance of the copy. (It's faster to read large blocks of data from disk at once, store those blocks in memory temporarily then write them to disk). The more memory you have, the more that can cached into memory to speed things up. Linux knows this, and it uses up all available memory, but no more, to make things faster. Your system is slowed to a crawl because it takes alot of processing power to handle a large file like that, especially if you have standard IDE drives that require the processor to handle alot of the work of copying files.
Swap doesn't get used because that would defeat the purpose. swap is -stored on the disk-. If you are reading from a disk, storing cache from that read on that disk will slow things down, not speed them up. So Linux just doesn't do it.
Also, keep this in mind. If you really maxed out your RAM, and swap really -wasn't- working, whatever program you have that's using all that memory, would get an "Out of memory" error and be killed by the kernel.
Let Linux do it's job and handle the memory for you. It does an excellent job. And no, the RAM purgers are pointless. They are pointless on Windows too. Most of them are gimmicks to get spyware/adware on your system.
masand : CONFIG_SWAP=y...and then u have to do a mkswap /dev/hdx ( and swapon /dev/hdx ater that ??)
irwinr: thanks for the detailed reply...guess that sorts out the ram stuff...my speed issues exist AFTER copying large files ..thats the annoying part...is there any workaround for that..?
Not really. New buffers push old buffers out of memory. So when you copy large files, the new buffer created by the copy command pushes the old cached copied of things like firefox out of memory.
So, it's not really a speed issue. After copying a large file, your programs will start no more slowly than they would if you had just rebooted the computer (Which would clear out the cache). For me, after I do memory intensive tasks (Which kill my cache), my system is just slightly sluggish for a few minutes. But after using all my regular apps for a few minutes, the cache gets built back up and I'm back to multi-tasking like a son of a gun.
As far as a workaround.... Not really. I mean, there may be a way to configure the your copy file utility (Which utility are you using, btw? Just the standard 'cp'?) to only use so much memory for buffering. If not, you could write up a quick file copy utility in C and make it use whatever amount of memory you want. But, it won't be as fast. Think about this:
If you make it so less data is buffered, you make the whole file transfer take longer. And while the transfer is taking place, your machine is probably -really- slow.
Would you rather have your system tied up copying files for a longer amount of time, or would you rather have it get the file transfer done, and be slightly sluggish for 2 or 3 minutes afterward?
-Jeremy
P.S. What exactly is the nature of these large file transfers? Are you copying data between two different disks in the same system? Or are you copying data between two partitions on the same disk? Or are you copying data across a network? What kind of drives are you using (SCSI, IDE, SATA. Any RAID?)
this seems fine!!
i remember making a logical drive as my swap partiton and that did nor work
making a primary one worked though
if u can try that ,give it a try
either drag/drop with kde or just the cp command..anyway my systems behaviour is exactly the same as yours so i guess theres no need to worry..usually my copying is dont across diff filesystems...sometimes across diff disks and filesystems...thanks for all the help..!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.