LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 05-24-2011, 11:10 AM   #1
origami-sheep
Member
 
Registered: Dec 2009
Distribution: Arch
Posts: 103

Rep: Reputation: 2
better use of swap? caching/similar?


hello!
i have a laptop with 3 gigs of (admittedly very slow) Ram and i partitioned in 6 gigs of Swap space to my hard disk.

my question is that my laptop rarely gets above 50% RAM and i have yet to see it with anything in swap so is it possible to manually make linux load certain programs into ram/swap on startup? is there something useful i should be doing with all that swap? (i am not exactly pushed for harddrive space

thanks in advance
 
Old 05-24-2011, 11:24 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Why do you want to load programs from RAM (fast) to disk (slow)? That makes no sense to me.
Also I think that 6GB is far to large, what applications do you run on that system? If you hardly ever use swap, and your RAM is almost always at 50% I would reduce that to 1GB and use the rest for other purposes.
 
Old 05-24-2011, 11:24 AM   #3
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 111Reputation: 111
You've got plenty of RAM, more than plenty of swap, and hard disk space to spare. So... where's the problem?

If you think your RAM is slow, wait until you start running things out of swap. The purpose of swap space is to be an overflow area if you start maxing out your RAM, but you take a severe performance hit to use it. RAM is accessed at CPU clock speed, and disk access has to wait for head seek, and be clocked across a slower interface. Rejoice that your swap is going unused.

If anything, the tuning opportunity presented here is to reduce swap and reclaim some disk space... but since you're not constrained for disk space, I wouldn't worry about it.
 
Old 05-24-2011, 02:10 PM   #4
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
I agree with the others that a 6 GB ram is useless when your system always has at least 1.5GB of free ram.
I also agree that it's not a big deal, and can wait until the next time you install Linux.

Now, what you can do with your extra ram, is create a filesystem in RAM. if you do things like video encoding using multiple passes, you would store the intermediate files in that ram filesystem.

this page should work: http://www.vanemery.com/Linux/Ramdisk/ramdisk.html

Something else you may be able to do is pre load some files in RAM for future use (openoffice, firefox, etc ...). I'll let someon else answer here as i don't know how it's done
 
Old 05-24-2011, 02:49 PM   #5
rich_c
Member
 
Registered: Apr 2008
Location: UK
Distribution: Mepis; Maemo; openSUSE
Posts: 384
Blog Entries: 74

Rep: Reputation: 81
Here's an article on the subject. It's interesting to note that Andrew Morton sets his workstation's swappiness to 100. Personally, I go for 30-40 or the 'standard' 60.
 
Old 05-24-2011, 02:59 PM   #6
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,378

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
I simply allocate 1.5 times as much swap-space as my system has RAM, and leave the swap-tendency values at their default values.

I want the system to have somewhere to go, if it starts running short of available space in RAM, because the only alternative that the system has is to start killing processes. But under ordinary circumstances, these days, the system should not have to resort to swapping at all. To my way of thinking, "dirty pages" can stick around in RAM as long as they care to, until and unless some actual memory pressure moves them aside.
 
Old 05-24-2011, 03:02 PM   #7
origami-sheep
Member
 
Registered: Dec 2009
Distribution: Arch
Posts: 103

Original Poster
Rep: Reputation: 2
sorry guys i think you misunderstood: i do NOT want to move things from RAM to swap as that would obviously be completely stupid

however; it is my understanding that A) swap is regarded as a baaad thing when actually it is very useful (but i dont know what for other than when ram is full)

and B) that Linux "aggressively swaps to disk" which it never seems to

what i want to know is if i can tell my computer to load programs like firefox into RAM, in a sort of ready state, and if the swap could be used to speed things up

thanks for the input though: especially the link.
 
Old 05-24-2011, 03:32 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Quote:
Originally Posted by SL00b View Post
RAM is accessed at CPU clock speed
That would be cool, bad sadly we don't have RAM at this speed yet.

Quote:
what i want to know is if i can tell my computer to load programs like firefox into RAM, in a sort of ready state, and if the swap could be used to speed things up
This can be done, but you don't need swap for it. Would be useless with swap, why should a loding from swap (disk) should be faster than from filesystem (disk)?
Have a look at the programs preload and prelink, I think they do what you want to achieve.
 
Old 05-25-2011, 05:55 AM   #9
origami-sheep
Member
 
Registered: Dec 2009
Distribution: Arch
Posts: 103

Original Poster
Rep: Reputation: 2
hmmmmmmm that is most definately true, disk is as fast as disk is

and as for prelink and preload: what exactly do they do? i am finding it a bit unclear
 
Old 05-25-2011, 05:57 AM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
preload will load applications you use often into RAM at boot time to fasten the start-up time. prelink will do that for the necessary libraries.
 
Old 05-25-2011, 08:22 AM   #11
Mr. Bill
Member
 
Registered: Mar 2011
Location: Maryland, USA
Distribution: Xubuntu 14.04 - 64
Posts: 182

Rep: Reputation: 14
Quote:
Originally Posted by origami-sheep View Post
and B) that Linux "aggressively swaps to disk" which it never seems to
Actually, it's the opposite-- Windows swaps aggressively to "save" system resources, although I've yet to understand exactly for what. Linux, on the other hand, uses system resources for faster, smoother program flow, and swaps as a last resort.
 
Old 05-25-2011, 10:34 AM   #12
origami-sheep
Member
 
Registered: Dec 2009
Distribution: Arch
Posts: 103

Original Poster
Rep: Reputation: 2
well whoever said what i heard is wrong then that makes sense
 
  


Reply

Tags
cache, ram, 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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to swap out (to swap area) page frames a process use? entertainyou Linux - Kernel 3 03-23-2011 09:52 PM
Gparted says swap has 5 Gb, grep SwapTotal /proc/meminfo says swap has 800 Mb rickrandall Red Hat 3 02-24-2010 12:09 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 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


All times are GMT -5. The time now is 09:42 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration