Beer28 wrote:

...
I can't help but notice that even though swap is enabled on linux, it's hardly ever used because I have alot of ram. It's not turned off. But linux will not use the disk swap partition space unless it's necessary. I can have 1 gig of ram on windows and have notepad open and it will still use the swap file if I have it enabled. It obviously doesn't need it, why is that?

Why is swap space on windows used when you have enough physical ram to handle the processes? As opposed to it not being used until it's necessary on linux?


This is actually really crappy behavior on the part of Linux.  In my experience, in real load scenarios, the behavior of swapping out entire processes only when under heavy load tends to lead to trashing.  The system spends most of its time swapping out entire processes only to have to struggle to swap them back in so they can get their share of CPU time, to only then swap them back out again, etc.

Lots of systems, not just Windows, will page out unused pages ahead of time.  In certain cases (like heap pages which tend to be backed by swap), this paging out is pushed to swap.  So it's normal to see swap in use even though there are lots of free pages hanging around (i.e., lots of free RAM) -- on FreeBSD, or similar, this is what happens.

-B