On Thursday, July 28, 2005 @ 4:46 PM, Carlos Robinson wrote:
El 2005-07-29 a las 00:41 +0100, Jonathan Brooks escribió:
You forgot to email to the list.
Huh, what has swap got to do with suspending to disk? I thought it just mirrored what physical RAM you have installed?????
Well, ask the kernel developpers :-)
They decided to use swap space as space for swapping or suspending to disk. It makes sense to me, tasks are just swapped out completely before swapping out memory pages; it is a raw partition, no drivers involved: just ideal. In fact, when restoring, some memory pages are not swapped back in, they stay off for days. Look:
top - 02:42:07 up 16 days, 4 min, 25 users, load average: 0.08, 0.22, 0.27 Tasks: 166 total, 1 running, 165 sleeping, 0 stopped, 0 zombie Cpu(s): 8.3% us, 2.7% sy, 0.0% ni, 88.4% id, 0.3% wa, 0.3% hi, 0.0% si Mem: 775852k total, 682772k used, 93080k free, 13196k buffers Swap: 1052216k total, 224240k used, 827976k free, 404580k cached
Notice the used swap area, and ram used, free and cached.
Interesting. On a Windoze machine, when you start a program, it loads two copies of the program into memory, one into cache and one into active memory. If you close the program, the active memory area is freed, but the cached copy stays there until you do a restart or until the memory runs low and Windoze needs to reuse it. If you turn right around and re-start the program, the program is copied from the cache area of RAM over to the active memory area (a memory to memory copy), so that it starts faster the second time. Is this the same thing with swap on Linux? Is everything in "used" also in "cached", along with some copies of programs that are no longer executing (I e., the memory is available for re-use, if necessary, but also available for a fast load of the program)? Greg Wallace