linux swap space allocation


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From - Sat Sep 16 09:01:50 2000
Path: news.randori.com!newsfeeder.randori.com!newshub2.rdc1.sfba.home.com!news.home.com!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews4
From: Floyd Davidson <floyd@ptialaska.net>
Newsgroups: comp.os.linux.misc
Subject: Re: Why Does the EXT2 filesystem not need defragmentation.
Date: 16 Sep 2000 03:32:55 -0800
Organization: __________
Lines: 116
Sender: floyd@barrow.com Message-ID: <87snr0vafs.fld@barrow.com> References: <39BFE479.446835B2@escape.com> <87r96nzo91.fld@barrow.com> <slrn8s0ibq.1d4.cbbrowne@knuth.brownes.org> <87vgvzxxpr.fld@barrow.com> <8FB06AB90ogo1mynxwowaustcom@203.2.194.51> <87lmwuwgho.fld@barrow.com> <39C21644.BAB72B83@exit109.com>
NNTP-Posting-Host: p-697.newsdawg.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: gnus 5.8.3/XEmacs 21.1.9/Linux
Xref: news.randori.com comp.os.linux.misc:228954
X-Mozilla-Status: 8011
X-Mozilla-Status2: 00000000


Hate these ads?



Jean-David Beyer-valinux <jdbeyer@exit109.com> wrote:
>Floyd Davidson wrote (in part):
>
>> There are some other considerations.  Linux buffers disk reads,
>> and uses otherwise unused RAM for that purpose.  Hence the more
>> RAM you have available for disk buffering, the faster your
>> programs will generally run.
>
>I suppose so, but it depends a lot on your access patterns. I
>suspect that most of the stuff in my buffers and cache are not
>useful: I am rummaging around in a large database, running a 2-hour
>populate of the database. All the data coming in are new, and I
>read precious little of the data that are already there. The
>indices are in the cache (I hope), and that can help, but since I
>am mostly inserting new records, I imagine that the cache is mostly
>full of useless stuff.



Your particular userid may not, but then again it might.  Shell
scripts call binaries in /bin, /usr/bin, and /usr/local/bin
often, and various data files and configuration files are also
accessed often.



My Unix and Linux Troubleshooting E-Book will show you how to solve tough system problems!










Hence the quantity of re-usable data may be low, but it is also
possible even though small it might account for a much higher
percentage of disk activity than you might expect.
Additionally, the other data that you are reading might well be
available in sequential reads...  which means the others being
accessed from memory speeds up access to those that are read
from disk by not mixing non-sequential disk reads in the
process.



Suffice it to say that there is no doubt at least some benefit,
and it is essentially free because it uses a resource that would
otherwise be idle.



>> Linux will also swap out unused
>> processes, making the space in RAM they would otherwise take up
>> available for disk buffering.  Hence you do want _some_ swap
>> space allocated.
>>
>> I have a system similar to yours, in that it has 256Mb of RAM
>> and often is lightly loaded.  Here is what free says right now:
>>
>>          total        used     free   shared  buffers   cached
>>  Mem:   257972      242560    15412    30872    62268    62000
>>  -/+ buffers/cache: 118292   139680
>>  Swap:  315048       15928   299120
>>
>> Which indicates that 16Mb has been swapped out, and is available
>> for disk buffering.  (You can also get an idea how much swap I
>> might recommend. :-)
>
>Mine is:
>
>             total:     used:     free:  shared:  buffers:
>cached:
>Mem:  529330176 526209024   3121152 89923584 207638528 190623744
>Swap: 279642112  17080320 262561792
>
>This seems to support my view that no matter what the amount of RAM
>(iff there is "enough"), Linux uses about 16 Megabytes of swap
>space. ;-)



Not really.  It does mean that you and I have just about the
same amount of memory allocated to processes that are sleeping
virtually all of the time.  Right now, on my box that happens to
be  kflushd, kupdate, kpiod, kswapd, bash (five instances),
agetty (two instances), rpciod, lockd, startx, xinit, gnuserv,
and pppd.



Obviously I could run either more or fewer processes that would
result in the use of swap space. :-)



>> The actual virtual memory (RAM + swap) you *must* have amounts
>> to "more than the need for virtual memory will ever be".  And
>> remember that if your vm use exceeds the RAM + swap total, your
>> system will crash.
>
>Is this true of Linux? In the old days (around mid 1980s), a
>UNIX system would not crash when you ran out of memory.  The
>fork(2) routine would just give an error return. If a shell got
>that, it would just write "cannot fork", but the system would
>remain up. Of course, the sysadmin would start looking around
>for the memory hog.  Somewhere around that time, they reserved
>a little memory and a process table slot for the super-user so
>that something could be done.









Sure the system "remains up", but it is in a worthless state
until the sysadmin determines what has been arbitrarily killed
off and what has not.  The only sensible response is to reboot
immediately after discovering which process is hogging memory.
I may be a bit more liberal about the definition of "crash" than
most, but clearly a forced reboot even if it is at my leisure, is
a "crash".



>> (And if you use Netscrape, at some point the amount of vm it
>> uses will be all there is, no matter how much you have.  In that
>> case you want enough that you'll notice it before the crash...)
>
>On my systems, Netscape uses around 24 Megabytes, but it does not
>grow unbounded, even when I open multiple windows with it. Others
>report memory leaks, but I have never seen any. Does the memory
>leak without appearing in the Netscape line of the top command?



I don't remember the specifics now, but it has been positively
identified.  If I remember right it has something to do with
Java applets, which means if you access only the right web pages
it will never hit you at all.  I can often go for a week or two
and never have a problem.  Then I'll start searching for some
odd thing and after I've accessed a couple dozen odd sites I
notice that everything is slow to start up... and what I find is
that I have 200Mb of swap in use!



-- 
Floyd L. Davidson                          floyd@barrow.com
Ukpeagvik (Barrow, Alaska)













-
Google Friend Connect users can
comment on this page here


Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


ad

Views for this page
Today This Week This Month This Year  Overall
122143 1,281

/Bofcusm/552.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - Newsgroup




Unix/Linux Consultants


http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


http://thatitguy.com Business networking servers, Linux and Unix experts. In business since 1997! Windows and Exchange to Samba and Scalix migration experts.



Twitter
  • Dec 4 07:16
    Being tired will cost me at Poker tonight but I don't see how I can squeeze in a nap.
  • Dec 4 04:06
    Wife had a nightmare at 2:00 AM; I never got back to sleep. Gave up at 4:00 and got up.




card_image








Change Congress