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