(sorry for the Double post Bill I hit send too soon) Bill Anderson wrote:
Carlos E. R. wrote:
The Thursday 2007-09-20 at 06:41 -0500, David C. Rankin wrote:
Ok,
Now I'm confused... After all of the discussion about ram size/swap size, I decided to try and make my 1G Toshiba P35 laptop start swapping stuff to the swap file.
I opened everything I could think of, 4 konsoles, 2 Open Office files, 3 Gimps, 2 Firefox, 2 Kongueror, Kjot, knotes, ksnapshot, kstars, Amarok, Thunderbird and several more, but the memory required, as shown by top, *never* exceeded 1G. The more I would open, the more slight slowness would occur, but I *always* had 13k - 15k of memory left and *nothing* was ever written to the swap file.
It probably was taken from the memory used for buffers. The command 'swapon -s' will also tell you the used swap and where.
Just suspend the machine to disk, and get back: you will see that many things will remain swaped out. The computer is slow right after waking up, because needed things are not in ram and have to be read from disk. After a while, it is faster than before because it has got ridden himself of useless chunks in memory that has ben swapped out.
-- Cheers, Carlos E. R.
I have been avoiding this thread, because the answer is too long. For optimal performance, the kernel pre-allocates buffers and caches. It steals from these buffers and caches as it needs memory for applications. As for application memory usage, Linux does not keep all of the application in memory. Virtual memory is the memory map of an application. The physical memory only contains those pages in use by the application. Thus, if you run a command like top, you will see the virtual size and the resident size. As for swap space, the kernel only needs to send the anonymous memory pages of an application to swap space, the text (code) can be retrieved from the disk file for the application.
The kernel attempts to keep a certain percentage of memory as free, to avoid running out of memory. If a memory shortage occurs, the kernel will automatically kill applications based on their oom score. If push comes to shove, the kernel shall survive.
Bill Anderson WW7BA
Now that is a great answer! The veil of fog has lifted, I have learned something new, and I understand a lot better now why my memory allocation and swap behavior appear as they do in top. Thanks! -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 (936) 715-9333 (936) 715-9339 fax www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org