LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-15-2006, 06:12 AM   #1
krkda
LQ Newbie
 
Registered: Jul 2004
Location: Central Coast, Australia
Distribution: Mandriva 2006
Posts: 12

Rep: Reputation: 0
Why have a swap file when.... ?


Hi people,

Everybody will tell you no matter what OS you are installing, to always create a fixed swap file or a swap partition that it at least 1.5x or 2x the amount of physical memory you have in your system.

Thats fine, but I therefore ask the question: Why do you even really need a swap file when you have a system with say, 2GB of RAM?

If you have a system with only 32MB and you have a swap file with 64MB extra, theres 96MB of available memory :O!!! Still not enough to run X comfortably is it?!? I personally would make the swap just a little bigger than that.

But what if you have 2GB of RAM? Is it really necessary to have a swap partition that is 4GB in size?

Does the OS really need this much overflow? Is there a reason for this equation, or would this be simply a complete waste of disk space?

Not that 4GB would be a problem for most people, but don't you install more RAM in your system to stop it from using so much swap space so that our memory works a little faster?

Cheers
 
Old 04-15-2006, 06:52 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You want to have some swap memory, but with 2gb of ram, you don't need to follow the 2x memory guideline.
Also, depending on your CPU, there may be a 1 or 2 gb limit on swap size anyway.

However, some programs may assume that you have a swap partiton. So eliminating it completely may not be a good idea.

Last edited by jschiwal; 04-15-2006 at 06:54 AM.
 
Old 04-15-2006, 07:41 AM   #3
krkda
LQ Newbie
 
Registered: Jul 2004
Location: Central Coast, Australia
Distribution: Mandriva 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
You want to have some swap memory, but with 2gb of ram, you don't need to follow the 2x memory guideline.
I guess what I'm trying to get my head around is why when I have a really small system, I would use a small swap file (when i really do need a big one) and when I have a really large system, I use a lot of swap space (when I really only a small one).

One thing I've noticed with windows in particular is, that despite any registry parameters you might change to stop it from doing this, its kernel still dumps some instructions that are not being used off to the swap space. This makes room in the physical memory "super speed highway" for foreground applications. Admittently I don't know linux all that well, so I'm not sure if it works the same way or not. But because of this you should always have a swap space enabled.

But if the system fills up physical memory before it looks into virtual memory for overflow, why would an application even need to assume you have a swap file (and then write to it) in the first place when its not needed (assuming there is enough room in physical memory for it to run).

It's just one of the curiosity things thats been killing me for some times now. It would be nice to be able to understand some of these things.

Thanks in advance
 
Old 04-15-2006, 07:52 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
There are several discussions about this already. Use the search tool to find out what other people have had to say about this.
 
Old 04-15-2006, 08:56 AM   #5
krkda
LQ Newbie
 
Registered: Jul 2004
Location: Central Coast, Australia
Distribution: Mandriva 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you reddazz for your very help post there.

You should know that I spent 15 solid minutes searching through old forums with word combinations like:

virtual memory swap partition use and why

When I couldnt find anything I started this thread. After your post I spent a few more minutes searching and found an older forum on this kind of subject (after finding nothing more than "how do i partition my hard drive" threads.

Maybe I misjudged what words I should fit into a query the first time i sorted through, or maybe I did stumble across a result and didnt even see it at the time, who knows.

My point is my on earth did you bother wasting your time posting a reply as hopeless as that. Forums are made for helping out. If you really had to respond, couldnt you have at least posted a possible link to a thread if a "guru" like yourself knew where to find it ?!? I'm not saying that you should do my searching for me, but if you don't have something nice to say, why say anything at all?

But I'm the bad guy now am I not? And I feel like I am, in fact, the one now wasting my time on such a pointless reply. These forums are not made for blasting one another, but I just wanted to thank you for the kick up the backside I needed to find the answer to my question by blasting me in the first place.

If you could care less, I would advise you have a look at this thread:
http://www.linuxquestions.org/questi...d.php?t=195983

Jschiwal, thank you kindly for your input.

Cheers
 
Old 04-15-2006, 09:10 AM   #6
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
My point is my on earth did you bother wasting your time posting a reply as hopeless as that. Forums are made for helping out. If you really had to respond, couldnt you have at least posted a possible link to a thread if a "guru" like yourself knew where to find it ?!? I'm not saying that you should do my searching for me, but if you don't have something nice to say, why say anything at all?

But I'm the bad guy now am I not? And I feel like I am, in fact, the one now wasting my time on such a pointless reply. These forums are not made for blasting one another, but I just wanted to thank you for the kick up the backside I needed to find the answer to my question by blasting me in the first place.
You really need to grow up and stop making assumptions that when someone suggests something they are taking a dig at you. I was helping you out by suggesting you look at other discussions because people get fed up of discussing the same thing when answers already exist on this site. If you didn't know which terms to search for, it would have been polite to say "I searched for xxxx and xxxx but didn't find anything useful" instead of going on a personal attack. Posting a link for you is obviously doing your research for you and I am not obliged to do that but would have done so if you were not rude.

Anyway since I am not arrogant and rude like you, here is what you need to do:

Click on "Search" -> Advanced Search -> Enter "swap" as the key word -> Select "Search Titles Only" from the drop down menu. There are lots of results for threads similar to yours.

Last edited by reddazz; 04-15-2006 at 09:33 AM.
 
Old 04-15-2006, 09:12 AM   #7
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
Dude grow up, redazz had a valid suggestion, this has been discussed many time but you're obviously looking for a different perspective, get off your soap box.

The 2x rule is in my opinion misdescribed as a "rule", it's not, it's an estimate or a guide. Your 32MB example is a valid one however you aren't running full blown X on a machine with that limited specs anyway so who cares if it had enough for X? 96MB is plenty of available memory for a terminal session. Sure there is EmbeddedX etc but they have lower memory requirements. If you have 2GB RAM then 4GB is probably excessive yes, but you still need swap, the kernel expects it to be there.

Don't take it as something that is written in stone, take it as an idle suggestion and you'll see it makes a lot more sense. If you have a machine with 256MB RAM, why have 512MB swap if you're using it as a thin client? The idea is to use your head to think about the situation you're in and what solution applies to you.
 
Old 04-15-2006, 10:00 AM   #8
krkda
LQ Newbie
 
Registered: Jul 2004
Location: Central Coast, Australia
Distribution: Mandriva 2006
Posts: 12

Original Poster
Rep: Reputation: 0
I fired up at you reddazz because responses like that do not solve anything in cases like this. Let's leave it at that.

Quote:
The 2x rule is in my opinion misdescribed as a "rule", it's not, it's an estimate or a guide. Your 32MB example is a valid one however you aren't running full blown X on a machine with that limited specs anyway so who cares if it had enough for X? 96MB is plenty of available memory for a terminal session. Sure there is EmbeddedX etc but they have lower memory requirements. If you have 2GB RAM then 4GB is probably excessive yes, but you still need swap, the kernel expects it to be there.
Thanks cs-cam. I've never heard of embeddedX but I might look into it for another system.
 
Old 04-15-2006, 10:19 AM   #9
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
I fired up at you reddazz because responses like that do not solve anything in cases like this...
I beg to differ, the response would have helped you if you had asked what terms to search for instead of going on an unwarranted personal attack.

Quote:
Let's leave it at that.
Sure, I don't have time to waste engaging in unnecessary arguements which divert my attention from helping others.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is a swap file...? zameer_india Linux - Newbie 8 01-09-2005 10:35 PM
swap file linuxhippy Linux - General 4 10-11-2004 04:07 PM
Swap file not being used...why? ganja_guru Linux - General 6 12-08-2003 03:41 AM
Swap file sparkplug55 Linux - Newbie 2 08-11-2003 09:09 AM
SWAP File TJ60515 Linux - Newbie 4 07-30-2003 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:44 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