Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-20-2003, 08:59 AM   #1
Registered: Mar 2002
Location: malaysia
Distribution: Mandriva 2006 RC1
Posts: 486

Rep: Reputation: 30
why does linux need swap file?

for what?
Old 08-20-2003, 09:14 AM   #2
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248

Rep: Reputation: 30
Old 08-20-2003, 10:23 AM   #3
Registered: Aug 2003
Location: North Carolina, USA
Distribution: Onebase 2004-r2 | Updated through 6-10-04
Posts: 359

Rep: Reputation: 30
to encrease size of memory, and to free up the on borad memory, which makes programs run a little faster.
Old 08-20-2003, 10:51 AM   #4
Registered: Dec 2002
Location: IL
Distribution: NetBSD, Slackware, Gentoo, Debian, FreeBSD
Posts: 444

Rep: Reputation: 31
All operating systems use a swap file. There may be a few that don't, not 100% sure.

You can choose to run linux without a swap if you want to. Having at least 512MB of ram should be good enough to skip a swap.
Old 08-20-2003, 10:55 AM   #5
Registered: Jul 2003
Location: London
Posts: 548

Rep: Reputation: 31
It's also historical in that it all started when there wasn't enough RAM to run what was necessary, I think [although I'm not sure]. As wr3ck3d says, it is not ultimately necessary to have a swap file, however I would strongly recommend it, as some things tend to much up [such as the original installation] when you don't have a swap file.
Old 08-20-2003, 12:02 PM   #6
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
I've always been a minimal-swap advocate but I entered the DVD age finally last night and *that* eats some RAM. Still, it was mostly being cached and didn't dip into my swap too much for as much as I observed it and that was Linux's usual pre-emptive memory usage. I *might* have gotten by without a swap.

Actually, wr3ck3d, DOS doesn't use swap. DOS apps do create temp files all over the place but the system doesn't have a permanent swap file or partition. And I'm pretty sure most temp files are more to get around single-tasking limitations than low-mem limitations. And it's not just cuz DOS is lame - Linux (on average) uses a fraction of RAM in CLI that it uses in GUI.

But, yeah, long story short, swap's cheap additional (virtual) RAM.

And I don't know what the guy who wrote that Solaris thing was talking about regarding Linux. With top alone, at the bottom of the very man page is

free(1), ps(1), uptime(1), vmstat(8), w(1).

and free, ps, and vmstat, at the least, are relevant. And I'm sure that's not all.
Old 08-20-2003, 09:45 PM   #7
Registered: Aug 2003
Location: france
Distribution: suse/fedora
Posts: 105

Rep: Reputation: 15
it needs swap for running on old machines.
i have used both linux + windows (3.11) without swap which worked fine, but w98 flips without swap, and on a 512meg machine my linux was'nt happy. It may be that its used to catch memory leaks, but perhaps this is better discussed on a linux kernel writers forum, its a bit in-depth.
Old 08-20-2003, 09:57 PM   #8
LQ Guru
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
Swap is like using a small part of the hard drive to store information you may need quick somewhere else that in RAM (cuz in older time, RAM memory was a precious thing). So Linux doesn't have to search for these information on all the hard drive, they are stored and ordered in swap space... it is not very usefull these days because most computer have above 256 MB, but it may help, sometime.
Old 08-20-2003, 10:53 PM   #9
Senior Member
Registered: Feb 2003
Location: Calif, USA
Distribution: PCLINUXOS
Posts: 2,918

Rep: Reputation: 103Reputation: 103
why does linux need swap file?
You are not under the impression that Windows does not have a swap file by default are you?
Linux installations tend to prefer swap partitions. Before I ever had Linux on my computer I had read people advocate using a swap partition on Windows rather than the default swap file to increase speed. It did not seem odd to me that Linux asked for this on install. It is also possible to create a swap file for Linux if you choose.
There are already some good explanations for the why.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 12:57 PM
Sharing a swap file with linux and windows Doug Hammond Member Success Stories 5 07-11-2005 06:06 AM
2 linux distrubutions and one swap file? Rampage2884 Linux - Newbie 3 08-21-2003 01:36 AM
SWAP File TJ60515 Linux - Newbie 4 07-30-2003 03:37 PM
No Swap File tarballedtux Slackware 4 01-09-2003 02:07 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:06 AM.

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