LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Getting swap to work (https://www.linuxquestions.org/questions/linux-newbie-8/getting-swap-to-work-177766/)

Andy@DP 05-04-2004 11:41 AM

Getting swap to work
 
My swap space isn't used and I'm running quite high. Here is the output from free:
Code:

            total      used      free    shared    buffers    cached
Mem:        514736    466404      48332          0      52844    201488
-/+ buffers/cache:    212072    302664
Swap:      1028152          0    1028152

Thats fairly close to max ram and I can't afford new stuff just now. How can I get linux (suse) to use the swap and clear some ram?

TIA.

320mb 05-04-2004 11:56 AM

Code:

-/+ buffers/cache:    212072    302664
what I hightlghted in RED, is the physical RAM that is being used!!
your fine, really!!

Andy@DP 05-04-2004 12:02 PM

I thought it was the....
Code:

            total      used      free
Mem:        514736    466404      48332

that I had used.

So whats the top line then?

320mb 05-04-2004 12:13 PM

http://www.linuxquestions.org/questi...718#post896718

check out this post..........very good explanation.........

and this thread.............


http://www.linuxquestions.org/questi...631#post475631

qwijibow 05-04-2004 01:16 PM

i hear with the upcomming 2.6 kernels you can set swappyness by echo #percent > /proc/swappyness or somthing like that... 0 meansing down swap, 100 means swap loads..

Andy@DP 05-04-2004 01:36 PM

Is ths in the pipeline, or is it the latest stable 2.6 kernel?

J.W. 05-04-2004 05:44 PM

I don't think you really want to encourage your system to use swap, simply because the access time within RAM vs the access time to/from your hard drive is several orders of magnitude faster. The less you use swap, the better. Consider it this way: which will give you better performance (assume that RAM and swap are the same size and you are running a heavy load):

Using 95% of RAM and zero swap; --or--
Using 50% of RAM and 45% swap?

Obviously the former will be faster, because there is no disk I/O. Along these lines, what's the point of writing to disk when you have unused, available RAM? In this example it would be similar to halving the amount of RAM in your PC, and what benefit would there be in that? Swap should be considered a last resort, only to be used when physical RAM is exhausted (eg, demand for memory exceeds 100% of capacity) and the system has no other choice but to write out memory pages to disk. Forcing your system to write to disk as a matter of course while unused RAM sits idle is not what I woud consider to be a performance improvement. -- J.W.

Andy@DP 05-05-2004 02:38 AM

Thanks you guys,
I was a little confused about the whole free/used memory thing.

But thats cleared it up, cheers!

Zipler 05-05-2004 03:28 AM

Swap and ramdisk.
 
Ok, I Understand in those cases how it is determining how much memory is free, and how much is being used by cache and buffers. My machine has 512MB ram installed, it is showing that I am using 410 total. My only problem is, I have 400MB set aside for a ramdisk (I would assume 512-400=112) Approx.
Why is it showing that I have a total of 340 free, and not something in the area of 0, with the swap being used?


Code:

knoppix@ttyp0[/]$ free

                  total      used      free    shared    buffers    cached
Mem:      515160    418068      97092          0      36576    208788
-/+ buffers/cache:    172704    342456
Swap:      152580          0    152580

knoppix@ttyp0[/]$ df

Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/root                2471      1077      1394  44% /
/dev/cdrom              716702    716702        0 100% /cdrom
/dev/cloop            1914132  1914132        0 100% /KNOPPIX
/ramdisk                407024      792    406232  1% /ramdisk
/dev/hda5              608939    307231    301708  51% /mnt/hda5
/mnt/hda5/knoppix.img
                        297485      1766    295719  1% /home/knoppix

Please let me know what you think, or what you know.
Thanks alot!

ZipleR

qwijibow 05-07-2004 09:09 AM

it all depends on how much ram you have, and what you are doing with it !

normally, i dont want my machine to swap, i have half a gig of ram which is way more than i need, so swapping is pointless.

however not too long ago i was working on an AI program.
it used 400 megs of ram, and took 1 hour to complete.

in this case, hundreds of megs of ram were sat there doing nothing for most of an hour..
just waiting untill the program had finished so the search tree could be traced,
in this case, it would have been good to swap.


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