>> Then why not have a really big swap file?  If swap is useful as a
>> second layer of caching behind RAM, why doesn't everyone with some
>> extra hard drive space have a 100GB swap file?
>>
> You've not understood what I said, I think.  Swap is not useful as
> filesystem cache.  Swap is as efficient (probably a little less) than
> the files on the disk.  It's RAM that's efficient as filesystem cache.
>
> Where swap comes in is the kernel can swap out pages from "stale"
> processes, and reclaim the RAM as filesystem cache.

That all makes perfect sense, but if a small swap is good and a large
swap is not any better, I'm missing something.  Maybe the pages from
stale processes never total more than a small amount?  I don't see how
that could be.

- Grant


> Think of it this way:  You have a house with an attic. Now the attic is
> not as "efficient" as say, the middle of your living room.  You have a
> Christmas tree, but you only use that Christmas tree maybe once a year.
> Now it's much more efficient to keep that Christmas tree in the attic
> for 11 months of the year and use that reclaimed space in your living
> room for.. say a coffee table.  Then, when you need that Christmas tree
> in December, you pull it out of the attic and maybe put the coffee table
> up in the attic for a month.
>
> The Christmas tree represents a process that's just sitting out there
> doing not much half the time, but taking up space.  The space in your
> living room is RAM, and the space in your attic is swap.  The coffee
> table is filesystem cache.

Reply via email to