LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   why does linux need swap file? (https://www.linuxquestions.org/questions/linux-software-2/why-does-linux-need-swap-file-83814/)

futurist 08-20-2003 08:59 AM

why does linux need swap file?
 
for what?

nephilim 08-20-2003 09:14 AM

http://www.meangene.com/notes/linux_swap.html

questionasker 08-20-2003 10:23 AM

to encrease size of memory, and to free up the on borad memory, which makes programs run a little faster.

wr3ck3d 08-20-2003 10:51 AM

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.

andrewlkho 08-20-2003 10:55 AM

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.

slakmagik 08-20-2003 12:02 PM

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. :D 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.

utopicdog 08-20-2003 09:45 PM

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.

Half_Elf 08-20-2003 09:57 PM

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.

2damncommon 08-20-2003 10:53 PM

Quote:

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.


All times are GMT -5. The time now is 08:25 PM.