LinuxQuestions.org
Review your favorite Linux distribution.
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, 04: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, 04:15 PM   #17
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
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, 04:19 PM   #18
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 -Current
Posts: 889

Rep: Reputation: 182Reputation: 182
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, 07:05 PM   #19
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
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, 07:37 PM   #20
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
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 07:38 PM.
 
Old 08-18-2011, 09:21 PM   #21
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
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, 07: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 07:08 AM. Reason: error typing
 
Old 08-19-2011, 07: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, 12:28 PM   #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 12:41 PM. Reason: error typing of the ram value
 
Old 08-19-2011, 04:24 PM   #25
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,170

Rep: Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208
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, 04:37 PM   #26
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable, amd64
Posts: 805

Rep: Reputation: 32
@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, 06: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, 06:32 PM   #28
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 10:15 PM   #29
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
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


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
swap file vs. swap partition verndog Ubuntu 16 07-09-2012 09:49 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 03:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 11:46 AM
Swap Partition vs File Philips Linux - General 12 07-04-2006 10:00 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 09:04 AM


All times are GMT -5. The time now is 04:07 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration