Given that we do more and more GUI (on the web and otherwise), 384mB is now "not very much" and almost certainly would need swap - or, better, more ram.
From: Floyd Davidson <floyd@ptialaska.net> Subject: Re: Is this why my system hung? Date: 29 Mar 2002 12:07:13 -0900 References: <3CA48F89.5010407@sandia.gov> <3CA4997F.9040201@web.de>
<3CA4BEE0.5060207@sandia.gov> "Christopher R. Carlen" <crcarle@sandia.gov> wrote: >Thorsten Hirsch wrote: >> Christopher R. Carlen wrote: >> >>> Hi: >>> >>> I am running Suse 7.3 with 2.4.10. I am aware that the 2.4 kernels >>> require that one has swap = 2 * RAM, but on this machine I hadn't set >>> that up properly. >> >> > [...] >> >>> Did this happen because I don't have swap = 2 * RAM? >> >> >> No, you don't need a swap when you've enough memory. My machine has >> 384MB RAM and no swap and I experienced no problems so far (Mandrake 8.2). >> Perhaps your disk is full? That is absolutely *TRUE*.
However, in fact on a machine with 384Mb of RAM it perhaps would be of some benefit to add at least some swap. That is because the system will page out all or parts of programs that are never active, and the free'd up RAM is then used for disk buffer and cache, which does make the system faster. >Maybe you have had no problems, but I think it is important to realize >that 2.4 kernels want swap=2*RAM. I read this in an article about That is absolutely *FALSE*. It is based on fact, but confuses two issues and draws the wrong conclusions as a result. >problems people had with the 2.4 kernels when they first began to be >employed in servers. They crashed all over the place. Things improved >a lot after people realized the swap requirements, but 2.4.x still had >stability problems to make it questionable for high load servers until >more recently. I don't know where this fact? is mentioned in the kernel >documentation. Hopefully some knowledgeable person can point this out. When first released the 2.4.x kernels simply had a buggy virtual memory system which was not properly releasing allocated disk space. The bug was fixed. That is often confused with the BSD derivation of that buggy virtual memory system. BSD 4.3 (and I'm not sure which others) required at least a 1:1 RAM to swap ratio because in order to execute a program it *had* to be loaded into swap as well as RAM. Virtual memory was not more than RAM until the swap space was more than RAM. Hence to have virtual memory equal to twice the RAM size, swap had to be twice the size of RAM. (That will provide virtual memory 3 times the size of RAM on Linux.)
The current 2.4.x Linux kernels are not using that virtual memory system, and it did not have that requirement even when it was being used. >~ $ df >Filesystem 1k-blocks Used Available Use% Mounted on >/dev/hda5 10080488 3086684 6481736 33% / >/dev/hda1 101089 4402 91468 5% /boot > >Doesn't look full. I changed my swap partition to 1GB, and put in Clearly "df" does not show stats about either RAM or swap. Try running "free". >another 256MB RAM. I ran the konqueror search again, and watched in >top, that kdeinit ate up to about 450MB of the RAM in the process of the >search. This time I didn't have any problems. However, the *ratio* of RAM to swap didn't have *anything* to do with the differences observed! >Before, I had 256 MB and about 120MB swap. The system thrashed to >pieces. I am not sure what would have happened if I had 256MB and 512MB >swap. Given what you describe, it was not thrashing to pieces. It was simply totally out of memory! If you commonly run processes that use 450Mb of virtual memory, there are some hard and fast rules that must be followed. You *must* have more than 450Mb of virtual memory! Virtual memory (VM) is equal to RAM + swap. Of course using RAM is fast and using swap is slow. Hence any process that uses more VM than the amount of RAM is necessarily going to be slow. But if you have 256Mb of RAM and 120Mb of swap, thats only 376Mb of VM and a process that needs 450Mb of VM is simply not going to run at all. Clearly having 512Mb of RAM not only solved the out of memory problem, but also avoided having the process run from swap too, which would have been slow at best. (I'm ignoring the possibility that other processes may be running at the same time, and the combination of all processes is what actually counts, not just any one process.) Think about the swap should equal two times the RAM concept for a bit in relation to practical systems. If you have 64Mb of RAM, and only 128Mb of swap, the machine can't run total processes exceeding only 192Mb. The way to allow it, with only 64Mb of RAM, to run a process that needs 450Mb is to provide at least 400Mb or so of swap space. That is more than 5 times as much swap as RAM. On the other hand, put 1024Mb of RAM into that box, and there is simply no requirement at all to have *any* swap space! The ratio rule of thumb simply does not apply to Linux. >Still not sure what it all means. I suppose find may be better than >konqueror for file searches. -- Floyd L. Davidson <http://www.ptialaska.net/~floyd> Ukpeagvik (Barrow, Alaska) floyd@barrow.com
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar