LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-15-2005, 10:26 PM   #16
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87

Quote:
Originally posted by syg00
As an aside I run a Gig plus 5 Gig swap, and I regularly see 2 Gig of the swap actively in use.
Not your typical user, but there are cases where it really gets used.
If you run 1G of RAM and regularly see 2G of swap in use, then you'd be doing yourself a huge favor by installing more RAM. As you know, the only time swap is used is when system loads push RAM past capacity, and the system is forced to write memory pages to disk. Since access times within RAM are measured in nanoseconds but access times from the hard drive are measured in milliseconds, the less your swap is used, the faster your system is. Personally, my view is that swap should be used only on an occasional basis. Just my opinion -- J.W.
 
Old 08-16-2005, 03:33 AM   #17
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 31
Quote:
Originally posted by J.W.
If you run 1G of RAM and regularly see 2G of swap in use, then you'd be doing yourself a huge favor by installing more RAM. As you know, the only time swap is used is when system loads push RAM past capacity, and the system is forced to write memory pages to disk. Since access times within RAM are measured in nanoseconds but access times from the hard drive are measured in milliseconds, the less your swap is used, the faster your system is. Personally, my view is that swap should be used only on an occasional basis. Just my opinion -- J.W.
... like when you don't have more money for additional RAM? (like me )
 
Old 08-16-2005, 03:34 AM   #18
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 31
Quote:
Originally posted by J.W.
... Personally, my view is that swap should be used only on an occasional basis. Just my opinion -- J.W.
... like when you don't have more money for additional RAM? (like me )

I agree 1xRAM + a little (I use RAM+256Mb with my laptop, which has 512Mb of RAM) is a good thing if you want suspend2disk.
 
Old 08-16-2005, 03:52 PM   #19
linmix
Senior Member
 
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993
Blog Entries: 1

Rep: Reputation: 46
Quote:
Originally posted by J.W.
If you run 1G of RAM and regularly see 2G of swap in use, then you'd be doing yourself a huge favor by installing more RAM. As you know, the only time swap is used is when system loads push RAM past capacity, and the system is forced to write memory pages to disk. Since access times within RAM are measured in nanoseconds but access times from the hard drive are measured in milliseconds, the less your swap is used, the faster your system is. Personally, my view is that swap should be used only on an occasional basis. Just my opinion -- J.W.
I'm confused. If that is true, if my sys isn't supposed to use swap unless it runs out of swap, how come right now I'm using about 50% of my ram and also about 150 Mb of swap and the sum of the two doesn't get near the total amount of ram I have??
 
Old 08-16-2005, 08:31 PM   #20
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Some amount of swap usage is normal (and perhaps even inevitable), and of course the actual level of swap usage you see will depend on the particular tasks that were running at the time you were measuring. Light or occasional usage of swap is no cause for concern, and as I suggested, I'd recommend having a modest swap space, just to play it safe. In contrast however, if swap usage becomes chronic and heavy, then your overall performance will be impacted, because of the fact that reading data that's already in memory is orders of magnitude faster than going out to the disk to read it. To clarify my previous comment, I'm assuming that the amount of swap usage that syg00 described is a typical amount seen rather than the all time highwater mark, and if so, adding more RAM should produce major gains

An excerpt from an O'Reilly book explains it a lot better than I can.
Quote:
Memory performance begins to affect overall system performance ... [when]... the demand for physical memory by all currently running applications, including the kernel, exceeds the available amount. The system is then forced to begin paging, or writing unused pieces of memory to disk. If the low memory condition worsens, the memory consumed by entire processes will be written to disk, which is called swapping.
The full excerpt is quite lengthy and provides a lot more detail, but overall, in my experience high swap usage is inversely proportional to overall performance -- J.W.
 
Old 08-17-2005, 04:21 AM   #21
linmix
Senior Member
 
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993
Blog Entries: 1

Rep: Reputation: 46
Thanks for the clarification.

The swap use I described is pretty standard for my system, and to make things even stranger, I have a couple of system monitor applets running in the gnome taskbar (just for the heck of it) and when my pointer hovers over the memory indicator it tells me I'm using 90% of memory while if I open the system monitor window it informs about 60% ram use and only 20% swap use. Any idea where this incongruency might come from? Is my system for some reason unable to use more memory even though it's available, is memory usage being badly informed or calculated? Could there be an error in my memory configuration?

Thanks in advance

Linmix
 
Old 08-17-2005, 01:40 PM   #22
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Linux handles memory differently than Windows, and tends to keep processes loaded in memory (thus giving the appearance of a higher usage level). I think this article on memory management explains things pretty well -- J.W.
 
Old 08-17-2005, 03:20 PM   #23
linmix
Senior Member
 
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993
Blog Entries: 1

Rep: Reputation: 46
thnx for the link on memory usage; very informative

(It doesn't explain why my system informs 90% usage when in fact it 's using under 30% - could it be a bug?)
 
Old 08-17-2005, 10:44 PM   #24
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Depends on the definition of "using".
Different code may well look at different numbers.
Look at the "free -m" in the referenced link - the "used" memory (451 from 503) is very close to your 90%.
The "true" (for some value of true) usage is a bit over 28% (143 from 503).

When you don't know the inputs, you can't compare the numbers.
I think it unlikely you have a bug.

J.W. Your concern about my situation is appreciated but misplaced.
I choose to run with that amount of active swap. I can also choose to vary it to any number I wish - including (effectively) zero.
 
Old 08-17-2005, 11:59 PM   #25
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
I wasn't being critical - obviously you are free to do whatever you want with your own system. I interpreted your original comment that you "regularly [saw] 2 Gig of the swap actively in use" to mean that the load you were placing on your system was regularly consuming not only 100% of your RAM, but also was requiring your system to write out an additional 2G of data to hard drive during typical sessions. Obviously a scenario like that would benefit from having additional RAM installed, hence my post.

OTOH, if you merely meant that you had allocated a 2G swap space on your system, and that you frequently observed that the level of activity on that 2G swap space was non-zero, those are two entirely different scenarios. Regards. -- J.W.
 
Old 08-18-2005, 12:56 AM   #26
linmix
Senior Member
 
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993
Blog Entries: 1

Rep: Reputation: 46
there's a huge discrepancy between the 'system monitor' output and the 'free -m output. According to the latter oly ram is being used, while the latter informs 2/3 ra, and some swap to complete the same number.
 
Old 02-02-2007, 04:21 AM   #27
digital8doug
Member
 
Registered: Aug 2006
Location: Near Binghamton, NY-the recent FLOOD zone
Distribution: Sabayon 351, Mepis8, oSuse11.3, Kubuntu8.1, Fed10, Slack12.1 #426299 RLU
Posts: 145
Blog Entries: 1

Rep: Reputation: 15
Question What use requires SWAP=2xRAM? Would non-linear Digital Video Edit possibly use >>2x??

+ J.W.: TY for all the info! 2gb DC DDR2-533, with 2GB swap part. I have habit of keeping many browser windows open (20+), some windows may have multiple tabs (4 to 8) in each. My way of researching, tracking and learning stuff (+eBay items). I can pick the browser window that has the topic of interest w/o having to resort to reopening via bookmarks. Have seen >75% of swap used when FFox or Opera browser used.
I will have many hours of reading for later when not on-line. LT is placed in Stby while in transit. All browser windows return OK on the restart later.
Quote:
Originally Posted by syg00
SNPD/EDTD run a Gig plus 5 Gig swap, and I regularly see 2 Gig of the swap actively in use. Not your typical user, but there are cases where it really gets used.
What is the non-typical use you have? How do you chose to change size of the active swap while running O\S?? Does it improve your system performance?? {TY for the RSVP, Guess your use is quite non-typical}
- - - - - -
**{7033 edit}:On this LT, would a swap file >2x RAM (vs SWAP part?) actually help during Video Editing? How much larger?**
Can both a SWAP part & a swap file be used effectively in recent Linux releases. (Thinking make a 256MB part, then swapon a multiGB file when needed in DVE?)

On my 4GB SD have noticed R/W is definitely much slower when >3.5GB on the card (Storage only, not using as VM yet)
IMHO; 8GB definitely sounds excessive for any current typical uses. Maybe n-l DVE of multiple projects would use all of RAM and then a majority of SWAP. [But Who knows where we may be with programs in 2-3yrs if b.b.88 wrote one to effectively utilize a 8GB swap]

Last edited by digital8doug; 02-02-2007 at 02:40 PM. Reason: TY for the info & replies. Want to try VM on removable device (Large SD card). ALSO Must find my links about sharing Virtual Memory btwn MS & Linux. Old info @ LDP, not sure if still valid on
 
Old 02-02-2007, 04:50 AM   #28
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
You can have unexpected behaviour and software crash if you don't have swap, even very small. Or you have to disable the paging mechanism (probably in the MMU handling)

Nowadays swap files is said to be as fast as swap partition.

For suspend(2) you can write your memory image to a file also.
 
Old 02-02-2007, 05:30 AM   #29
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
I run a mainframe emulator - upon which I run an O/S that also has it own paging.
Think VMware. Significantly different, but conceptuously close.

Handling swap is as simple as swapon/swapoff. I manage the workload on the client O/S to keep performance on the (optimized Gentoo) base Linux within acceptable limits.
 
Old 02-02-2007, 08:11 AM   #30
inspiron_Droid
Member
 
Registered: Dec 2006
Distribution: Debian (Wheeze)
Posts: 391

Rep: Reputation: Disabled
When I insralled Ubuntu 6.06 from scratch on my home desktop I allocared a eight gigabyte swap aperirion even thou I had 1GB off ram because I'm planning to up grade my ram to the motherboards maximum capacity of two gigs of ram but didn't desire a wimpy swapaprtiton.
 
  


Reply

Tags
laptop, memory, swap


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
laptop freezing up, swap disabled? ehawk Linux - Hardware 0 10-04-2004 03:27 PM
Swap-out cd/floppy drive on laptop. acratus Slackware - Installation 4 07-24-2004 02:02 PM
Mandrake 10.0 Laptop Won't Boot Past "Activating Swap Partitions"? Aaron Josephson Linux - Software 0 06-26-2004 08:02 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:15 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