LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2011, 03:12 PM   #16
zemir
LQ Newbie
 
Registered: Jul 2011
Location: Calabria, ITALY
Distribution: debian squeeze
Posts: 24

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by PrinceSharma View Post
Okay, answer to the question is swap partition is considered better. reason mentioned above by gurus
Gurus on not Gurus, my experience is essential and i always made such as i know and such as i see.
 
Old 08-18-2011, 03:15 PM   #17
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
With a swap partition one can choose where on the disk it resides and place it where the disk throughput is highest.
Yes, but I would place it where the disk throughput is lowest!

In a modern system, swap is there for insurance, not for heavy use. Let files that really get used have the beginning (faster) part of the disk.

If you have too little ram for the active portion of the anonymous data in use by your programs, then swap speed is critical. With swap in the fastest position on disk, you could have a really slow system instead of a really incredibly slow system. But I don't think that is the situation for anyone asking current questions about swap. If you have too little ram for your workload, get more ram.
 
Old 08-18-2011, 03:19 PM   #18
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 -Current
Posts: 890

Rep: Reputation: 186Reputation: 186
Quote:
Originally Posted by zemir View Post
Gurus on not Gurus, my experience is essential and i always made such as i know and such as i see.
Of course, it should be acc. to you need .
 
Old 08-18-2011, 06:05 PM   #19
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
The concept that there is a speed advantage in placement on disk is another hoary old chestnut that should be discarded. The I/O elevator(s) in use on almost all systems negate that premise completely.
Not to mention disk caching - and yes, swap now uses (compressed) cache to reduce any meagre physical I/O that does actually occur.
 
Old 08-18-2011, 06:37 PM   #20
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by syg00 View Post
The concept that there is a speed advantage in placement on disk is another hoary old chestnut that should be discarded.
Try testing that (I have). Disk position can make a big difference.

Last edited by johnsfine; 08-18-2011 at 06:38 PM.
 
Old 08-18-2011, 08:21 PM   #21
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
As have I. Test cases can be constructed to generate any outcome desired.
For the normal (home) user, I stand by my contention.
 
Old 08-19-2011, 06:07 AM   #22
zemir
LQ Newbie
 
Registered: Jul 2011
Location: Calabria, ITALY
Distribution: debian squeeze
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by johnsfine View Post
Yes, but I would place it where the disk throughput is lowest!

In a modern system, swap is there for insurance, not for heavy use. Let files that really get used have the beginning (faster) part of the disk.

If you have too little ram for the active portion of the anonymous data in use by your programs, then swap speed is critical. With swap in the fastest position on disk, you could have a really slow system instead of a really incredibly slow system. But I don't think that is the situation for anyone asking current questions about swap. If you have too little ram for your workload, get more ram.
If i have understand well, and it is true what you all say, then it is better a swap file: you can put it in the first part of disk, it is more easy and more fast its access, it garantees more performance and it is more easy to manage (you can resize it how you want). May be a little difference only what file system you want to use and by its performance depend the performance of the swap.

Last edited by zemir; 08-19-2011 at 06:08 AM. Reason: error typing
 
Old 08-19-2011, 06:35 AM   #23
Nadeen Spirit
LQ Newbie
 
Registered: Aug 2011
Location: Egypt
Distribution: Fedora 15
Posts: 7

Rep: Reputation: Disabled
I found this small comparing

Swap file == slow, slow performance, ext3/ext2 format -> not dedicated
Swap partition == good performance, dedicated for swapping only, in swap format
 
Old 08-19-2011, 11:28 AM   #24
zemir
LQ Newbie
 
Registered: Jul 2011
Location: Calabria, ITALY
Distribution: debian squeeze
Posts: 24

Original Poster
Rep: Reputation: Disabled
About systems with swap or without swap, today i have found some tests that i have made on my old desktop some years ago: it had 512mb of ram and slackware with 2.4 kernel. Without swap some applications does not works well and it often did crash during startup, example openoffice or gimp (in this case, i think, the memory is not workload at 100%, but kernel use swap); as well as did not work correctly some small applications and utilities that did resident in memory, they often did freeze. The situation did change completly with swap, file or partition; the same ram size or its double seems to be a good solution. I do not know you, but i do not trust of a system without swap.

Last edited by zemir; 08-19-2011 at 11:41 AM. Reason: error typing of the ram value
 
Old 08-19-2011, 03:24 PM   #25
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
On a desktop system, where the chance of actually using swap space is relatively small anyhow, a swap-file probably works just fine and it is perhaps somewhat easier to manage. Many operating systems use this technique by-default. The impact of one strategy vs. another can be expected to be "negligible" because the predicted use of swap is also, "negligible." RAM is now plentiful and cheap. (The "buck-a-meg" pricing model that was once contemplated by Japanese silicon manufacturers fortunately blew up in their faces.)
 
Old 08-19-2011, 03:37 PM   #26
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Rep: Reputation: 47
@syg00
(magnetic) disk drive is a lot faster at outer sectors.


there is one disadvantage with swap partition, you use up one of four primary partitions. now, it is possible to put swap on extended/logical partition, but it could produce some errors (at least it did in my case).

perhaps fragmentation might be problem when using swap file.
 
Old 08-19-2011, 05:21 PM   #27
zemir
LQ Newbie
 
Registered: Jul 2011
Location: Calabria, ITALY
Distribution: debian squeeze
Posts: 24

Original Poster
Rep: Reputation: Disabled
I think that the main linux distros should have in theirs install process the choice between swap file or partition; it seems to be more better first or second, it depend by the different cases.
However there are not never very important differences in performance, may be a bit more better a swap file in a first primary partition.

I think the swap file is not very common choice, from now and in the future these posts should have the effect to change the opinion and the habitudes of a lot of you ;-)
 
Old 08-19-2011, 05:32 PM   #28
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Even in a desktop system you have several processes accessing
disk at the same time, so the discussion about where to put
which files is pretty mote - most of the time spent will be
head movement of the disk, not on sequential reads from one
region of disk; more so in server class machines.

And while swap may not be heavily used in desktop system
with loads of RAM to spare the kernel paging out unused
or less used files may still make a noticeable performance
improvement by using the freed up RAM for caching of actually
heavily used bits.

I don't think that having swap, and swap in a separate
partition, is obsolete just because RAM is cheap. Even
on a box w/ 4GB I saw free RAM dwindling, and SWAP growing
ever so fast when e.g., using calibre to convert HTML docu
to epub for easy reading on an android pad. W/o swap the
OOM killer would have struck.


Cheers,
Tink
 
Old 08-19-2011, 09:15 PM   #29
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Quote:
Originally Posted by Tinkster View Post
Even in a desktop system you have several processes accessing disk at the same time, so the discussion about where to put which files is pretty mote - most of the time spent will be head movement of the disk, not on sequential reads from one region of disk; more so in server class machines.
s/mote/moot/
This is precisely the point. And the I/O elevators delay and consolidate I/O's to better utilise the disk. You have no say in the matter in a normal setup. And yes, swap does get included.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
swap file vs. swap partition verndog Ubuntu 16 07-09-2012 08:49 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
Swap Partition vs File Philips Linux - General 12 07-04-2006 09:00 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:51 AM.

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