1 |
On 23 February 2006 14:04, jarry@×××.net wrote: |
2 |
> "joaoemanuel1981" <joaoemanuel1981@×××××××.br> wrote: |
3 |
> > Do i not understand why needs swap, if have 1GB of RAM? |
4 |
> |
5 |
> 1. because if you have 200GB disk, cutting 1 or 2GB for swap does not |
6 |
> matter |
7 |
|
8 |
True. |
9 |
|
10 |
> |
11 |
> 2. because someone told me some apps want to allocate swap no matter how |
12 |
> ram you have (I think it was someone from hp-ux support, but I'm not sure |
13 |
> if this is true for linux) |
14 |
|
15 |
This is a myth. *No* application (under linux) can grab swap space directly. |
16 |
Applications ask the kernel for memory when they allocate it. The kernel, |
17 |
based on algorithms that balance free real ram, buffers and cache, returns |
18 |
either real ram as memory to the app or - if it is low on real ram - swap |
19 |
space. So what you do when adding swap space is extending your (fast) real |
20 |
ram with (slow) memory residing on your harddrive. |
21 |
|
22 |
> |
23 |
> 3. because it is always better to have too much ram/swap then too little |
24 |
Nnnnot always. There are circumstances when you do not want swap at all. |
25 |
Consider a box that has certain real time response requirements which cannot |
26 |
be met if apps are swapped out (actually parts of their code and/or data |
27 |
paged out) to the harddrive. In these cases, you do not want swap but enough |
28 |
ram to accommodate your running processes at all times. |
29 |
|
30 |
This and 2. also mean that it's quite pointless to add swap if your |
31 |
workstation has 16GB of ram and isn't used for image processing or other |
32 |
extremely memory-hungry tasks. |
33 |
> |
34 |
> 4. because if you do not set up swap, but need it later, it will not be so |
35 |
> easy to create it, if you partition all disk and leave no space left |
36 |
|
37 |
The times when we couldn't resize partitions under linux without holding our |
38 |
breath are over. |
39 |
|
40 |
> |
41 |
> 5. because it is a good *nix habit! :-) |
42 |
|
43 |
What does or does not constitute good *nix habits is at least debateable. |
44 |
|
45 |
If I needed a box that was fast at all times and (logical AND) money was of no |
46 |
concern I'd put real ram in until the bugger stopped using swap space and |
47 |
forget about swap. Since I do have to take monetary issues into |
48 |
consideration, I rather configure some (cheap and slow) swap and have less |
49 |
(expensive, compared to harddrive space, and fast) ram. How much ram and how |
50 |
much swap is an economic question. |
51 |
|
52 |
It all boils down to how and what for you use your box. If you need more |
53 |
memory than you have ram, are you willing to invest the money for more ram? |
54 |
No? Then you need swap. |
55 |
|
56 |
There are too damn many myths about swap out there. Like this one: Always |
57 |
configure twice as much swap as you have ram. Why? Why would I need more swap |
58 |
if I increased my ram? You need at least a little bit of swap for peak memory |
59 |
usage. Let's look at real numbers. Say, I am a bit low of ram for today's |
60 |
computers. I have 256MB ram. For peak usage, I add 128MB swap. I open so many |
61 |
applications/documents that the box starts swapping out 20MB. Sure, without |
62 |
swap space, I wouldn't have been able to open the last document. But nothing |
63 |
makes me stop there. I can as well run out of swap. |
64 |
|
65 |
If you have 2GB of ram and 2GB of swap your total available memory is 4GB. If |
66 |
you need more you have to add either ram or swap. What you add is your choice |
67 |
based on your needs for speed and the money you are willing to spend on |
68 |
memory. That's it. |
69 |
|
70 |
End of rant. |
71 |
|
72 |
Uwe |
73 |
|
74 |
-- |
75 |
Why do consumers keep buying products they will live to curse? |
76 |
-- |
77 |
gentoo-user@g.o mailing list |