Linked by Thom Holwerda on Sun 31st Aug 2008 16:15 UTC, submitted by cy
BeOS & Derivatives Thanks to Google Summer of Code student Zhao Shuai, Haiku now has support for a swap file. "As of revision 27233 it is enabled by default, using a swap file twice the size of the accessible RAM. The swap file size can be changed (or swap support disabled) via the VirtualMemory preferences. Swap support finally allows building Haiku in Haiku on a box with less than about 800 MB RAM, as long as as the swap file is large enough. [Ingo Weinhold] tested this on a Core 2 Duo 2.2 GHz with 256 MB RAM (artificially limited) and a 1.5 GB swap file. Building a standard Haiku image with two jam jobs (jam -j2) took about 34 minutes. This isn't particularly fast, but Haiku is not well optimized yet." The swap implementation borrows heavily from that of FreeBSD.
Thread beginning with comment 328707
To read all comments associated with this story, please click here.
Swap twice the RAM
by thecwin on Sun 31st Aug 2008 17:15 UTC
thecwin
Member since:
2006-01-04

it is enabled by default, using a swap file twice the size of the accessible RAM

I thought that rule of thumb was an ancient rule that doesn't have any bearing on modern memory allocation algorithms? Isn't it from the times where you needed at least as much swap as you had RAM?

Edited 2008-08-31 17:18 UTC

RE: Swap twice the RAM
by FooBarWidget on Sun 31st Aug 2008 18:34 in reply to "Swap twice the RAM"
FooBarWidget Member since:
2005-11-11

Yes, I don't understand why people still stick to it. I have 2 GB of RAM and I have no swap, and everything works fine. It would be insane to allocate 4 GB of swap for my system.

Reply Parent Bookmark Score: 4

RE[2]: Swap twice the RAM
by sgibofh on Sun 31st Aug 2008 18:56 in reply to "RE: Swap twice the RAM"
sgibofh Member since:
2007-03-31

it depends on what happens if the system crashes. some OS still dump the whole OS completely in SWAP before dying since you don't want it saved as a regular file on the filesystem.

When rebooting, the dump in swap is then saved into a regular file.

basically swap = 2xRAM is a bad idea, but there are sometimes reaons why it's space is needed. Don't know how HAIKU does this though.

Reply Parent Bookmark Score: 1

RE[2]: Swap twice the RAM
by fernandotcl on Sun 31st Aug 2008 19:05 in reply to "RE: Swap twice the RAM"
fernandotcl Member since:
2007-08-12

There's no rule of thumb, it always depends on what you're running. However, Haiku needs a default. For a work-in-progress operating system, I consider that default more than appropriate.

And it's not like you can't change it easily. It's a swap file, not a swap partition.

Also, I believe a big chunk of the Haiku community uses Haiku in more constrained environments. Swap space almost makes no sense for regular utilization when you have 2G of RAM, but you might require twice as much swap space if you have less than 512MB of RAM.

And what's all the fuss about this? If you have 2G of RAM in your machine, you most likely have enough disk space for a big swap file.

Reply Parent Bookmark Score: 4

RE[2]: Swap twice the RAM
by Rugxulo on Sun 31st Aug 2008 19:27 in reply to "RE: Swap twice the RAM"
Rugxulo Member since:
2007-10-09

Yes, I don't understand why people still stick to it. I have 2 GB of RAM and I have no swap, and everything works fine. It would be insane to allocate 4 GB of swap for my system.


Face it, modern OSes need to use lots of RAM, esp. for developers who are rebuilding things like GCC, OpenOffice, etc. Not saying that's typical or ideal, but it can be necessary for some things.

However, does anyone here know if using 2 GB RAM + 4 GB swap is even possible?? I mean, would that even work (on Haiku or any other 32-bit OS)?? Wouldn't it be unavailable at the same time anyways, only letting you use approx. 4 GB (or less) at once?

Reply Parent Bookmark Score: 2

RE: Swap twice the RAM
by Soulbender on Mon 1st Sep 2008 18:04 in reply to "Swap twice the RAM"
Soulbender Member since:
2005-08-18

Yes, it's an outdated rule but since a) it's the initial implementation and b) it's just the default, this is not a big deal.

Reply Parent Bookmark Score: 3