LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-31-2008, 05:46 AM   #16
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35

There simply is no logic in having more swap because you have more RAM. Obviously you need more swap if you have less RAM, and vice versa, and of course depending on the task at hand. Of course you may have the space, but these days the moment when you wish you had more available space for storage will come rather sooner than later. Where's the sense in saying 'A has a small box for storing things, so he should have another small box for storing things, while B has a huge box for storing the same amount of things so he needs another huge box because you never know'?

The sum total of RAM plus Swap must be enough to run what you need to run. If the system gets too slow, add RAM. That's all there is to it.

Robin
 
Old 10-31-2008, 01:41 PM   #17
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
The amount of swap you need with larger amounts of ram is just as relevant as when you have smaller amounts of ram. The swap is there for when you need more space than you have ram. If you have 512megs and you only occasionally use swap, you can get by with 512. If you are using that swap frequently enough that is slows down the system to the point it bothers you or is causing issues, then it is time to increase your ram. Now repeat those last two sentences replacing 512megs with whatever amount of ram you wish. It applies equally well for 512meg as it does for 32gigs. IF you have a great excess of ram (ram is cheap) for your needs, then you could drop back on the amount of swap. There are a lot of people out there that could get by with 512meg but are running 2gb, which is fine. This allows them to essentially never use swap, so dropping back the amount of swap they make available under those conditions is perfectly fine. However, if one regularly uses (say 90% of the time) 3/4 of the 2gb, I would argue that the 2X rule still applies. It becomes extremely useful for that other fraction of time (the 10%) when you are running larger or more tasks than usual.
 
Old 10-31-2008, 01:54 PM   #18
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
I don't see anyone arguing with you lazlow. The point I was trying to make is that if you're a relatively new user and you are starting with a 3GB machine, then chances of you needing any swap space are almost zero. Of course, there might be some minority of newbies who will immediately begin with high-end video editing or some other programming that is extremely memory intensive. Generally, though, such users already know they are going to use a lot of memory due to previous experience, and will plan accordingly.
 
Old 10-31-2008, 02:32 PM   #19
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I strongly recommend you have a swap partition even a small one. In many cases it will prevent the system from grinding to a halt when it runs out of RAM. (Yeah sure the OOM killer will help you, but it will still almost freeze before that happens)
 
Old 11-03-2008, 08:55 AM   #20
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
Of course the same thing happens once you have filled both RAM and swap. So what you need is a decent sum total, not more swap if you already have more RAM to begin with. If RAM is scarce you need much swap, if RAM is opulent you need less swap, if any.

Robin
 
Old 11-03-2008, 09:19 AM   #21
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Here are some articles that may convince you that swap, even a small swap partition is actually useful and a good idea even if you have 64 GB of RAM or more.

Quote:
Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.
http://www.linux.com/feature/121916

Quote:
As I write this, my 1024MB machine has 184MB of swap used out of 1506MB, and only 17MB of memory free. On old-Unix this would indicate a perilous situation: with numbers like this it would be grinding. But Linux is perfectly happy with these numbers: the disk is idle and it responds well.

The 184MB constitutes tasks that are running in the background, like the getty on the text console, or the gdm login manager. Neither of them has done anything much since I logged in days ago. From a certain overoptimizing point of view I ought to get rid of those tasks — although for the login manager it might be hard. But even then, there's probably lots of memory used for features of programs I am running that don't get invoked very often.

With swap, that memory is written to disk and costs very little. Without swap, it would be cluttering up RAM, as if I was down to only 840MB. Everything else would need to page a bit harder, but it wouldn't be obvious why.

Disk is cheap, so allocate a gigabyte or two for swap.
http://sourcefrog.net/weblog/softwar...rnel/swap.html

If you want to use your RAM to its fullest, make a swap partition and offload some of the useless pages and make room for more important things.

Last edited by H_TeXMeX_H; 11-03-2008 at 09:21 AM.
 
Old 11-03-2008, 10:59 AM   #22
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Tex, have you read the swappiness thread that I link to every now and again?
 
Old 11-03-2008, 01:37 PM   #23
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Quakeboy02 View Post
Tex, have you read the swappiness thread that I link to every now and again?
Uh, no, which one is that ?
 
Old 11-03-2008, 01:44 PM   #24
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by H_TeXMeX_H View Post
Uh, no, which one is that ?
Hope you find it interesting: http://kerneltrap.org/node/3000
 
Old 11-03-2008, 02:49 PM   #25
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Quakeboy02 View Post
Hope you find it interesting: http://kerneltrap.org/node/3000
Well, it seems the issue is a subject of debate, but what they seem to be debating more is not whether to have swap but how often or how much to swap. My swappiness is set to 60 (I think it's the default) and it works fine so far, it's true it rarely uses swap, but in some cases, especially when leaving the computer on for extended periods swap does get used somewhat. And then there are the times when some program decides to use up all my RAM and starts eating up swap ... that would be the time to kill it quickly. I guess it does also buy me some time in such cases.

Anyway, you decide, but I think there are benefits to having a swap partition, more so than not having one.
 
Old 11-03-2008, 05:09 PM   #26
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by H_TeXMeX_H View Post
Well, it seems the issue is a subject of debate, but what they seem to be debating more is not whether to have swap but how often or how much to swap.
That's more or less the same thing, isn't it? If you are of the "swap early" crowd, you'd want to have swap available to keep the memory "pure". If you're of the "swap late" crowd, then memory is where stuff belongs until memory starts getting full. Swappiness is more or less a measure of fullness, and having it set at 60 seems to be a good compromise.

Every rare now and then, I'll see about 180K (not M) bytes in swap. It happens at random, and it sits there until I reboot. I never notice that I have done something different than on any other day. I have 4GB of RAM, which is *way* more than I need.
 
Old 12-08-2008, 02:07 AM   #27
uniomni
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
I concur. To be able to hibernate which means that all memory is copied to swap you need at least as much swap as you have RAM.
Hibernate did not work for me on my ASUS EEE running Ubuntu until I increased the swap from a few hundred megs to a bit over 1GB.
What I am wondering, though, is what would happen if you try to hibernate a state that already uses swap for one or more applications?

Not that it really matters in most cases, but I am curious.

Cheers
Ole
 
Old 12-08-2008, 11:04 AM   #28
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
and then you can run a swap file to if needed.
 
  


Reply

Tags
installation



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SWAP - having trouble with swap auto mounting at boot lostdj Linux - General 2 08-05-2008 12:47 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 12:57 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration