Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.