1 |
>> Then why not have a really big swap file? If swap is useful as a |
2 |
>> second layer of caching behind RAM, why doesn't everyone with some |
3 |
>> extra hard drive space have a 100GB swap file? |
4 |
>> |
5 |
> You've not understood what I said, I think. Swap is not useful as |
6 |
> filesystem cache. Swap is as efficient (probably a little less) than |
7 |
> the files on the disk. It's RAM that's efficient as filesystem cache. |
8 |
> |
9 |
> Where swap comes in is the kernel can swap out pages from "stale" |
10 |
> processes, and reclaim the RAM as filesystem cache. |
11 |
|
12 |
That all makes perfect sense, but if a small swap is good and a large |
13 |
swap is not any better, I'm missing something. Maybe the pages from |
14 |
stale processes never total more than a small amount? I don't see how |
15 |
that could be. |
16 |
|
17 |
- Grant |
18 |
|
19 |
|
20 |
> Think of it this way: You have a house with an attic. Now the attic is |
21 |
> not as "efficient" as say, the middle of your living room. You have a |
22 |
> Christmas tree, but you only use that Christmas tree maybe once a year. |
23 |
> Now it's much more efficient to keep that Christmas tree in the attic |
24 |
> for 11 months of the year and use that reclaimed space in your living |
25 |
> room for.. say a coffee table. Then, when you need that Christmas tree |
26 |
> in December, you pull it out of the attic and maybe put the coffee table |
27 |
> up in the attic for a month. |
28 |
> |
29 |
> The Christmas tree represents a process that's just sitting out there |
30 |
> doing not much half the time, but taking up space. The space in your |
31 |
> living room is RAM, and the space in your attic is swap. The coffee |
32 |
> table is filesystem cache. |