Re: Naive Windows VM paging algorithm - is Linux better?

From: Floyd Davidson (floyd_at_barrow.com)
Date: 09/13/03


Date: 12 Sep 2003 15:26:07 -0800

Kirk Strauser <kirk@strauser.com> wrote:
>At 2003-09-12T16:45:45Z, Floyd Davidson <floyd@barrow.com> writes:
>
>> His suggestion has no merit. Running processes are not paged out unless
>> the system is in need of RAM. The solution then is to purchase RAM, not
>> to hog tie the VM system.
>
>Are you sure of that? I'm almost positive that FreeBSD pages out unused
>code pages, and I was pretty sure that Linux did this too.

Yes, but no not as you might think.

Linux (and as far as I know FreeBSD too) will attempt to keep
running processes fully in memory. That can be done when there
is sufficient RAM (for example, enough to use as a disk cache),
but of course might not be able to be done if RAM is used up by
running processes and paging is necessary to continue running
all processes. (Of course, if that happens your box is running
like molasses in January on the Arctic Ocean, which I assure you
is slow.) Hence the reason to buy more RAM.

There are also other optimizations. If the cache hit rate is
slow it makes more sense to reduce the cache size than it does
to flush idle processes to swap. Take, for example, the case
where a backup is being done, and every file is being read in...
but only once. On the other hand if the cache hit rate is high
it makes sense to increase the cache size and free up memory to
do so by flushing long sleeping processes to swap. And example
would be when repeated compiles of the kernel are being done.

That is one reason we can't say it takes x hours for an idle
process to be swapped out. It depends on what the system is
doing as to whether idle processes will be swapped at any given
time. And the cache itself is managed in a complex way too,
because data that is read in and then never accessed is treated
very differently from data that gets several hits and then
enters a long period with no hits.

Note that the effort to keep running processes in RAM is most
useful to servers, and less useful on a workstation, while
the relationship between cache hits to swap activity is more
important to workstations that to servers.

-- 
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com


Relevant Pages

  • Re: Optimization problem
    ... CPU core and is able to respond to the CPU at full speed (i.e. read or ... each of the four CPU cores has 32 KBytes of L1 cache for data (and ... When you go out of L2 cache as well, the CPU must rely on the plain RAM. ... harddisk) is really called _paging_. ...
    (comp.lang.java.programmer)
  • Re: Slow File Load Through ODBC Driver
    ... buffer cache from 772 Megs to 132Megs ... virtual) ram immediately to fox when fox generated a large select statement. ... XP professional (suspecting kernel memory handling) -- no effect; ...
    (microsoft.public.fox.programmer.exchange)
  • Re: speeding up my runtime on a c6713.
    ... it for cache, and possibly enabled the cache controller? ... I ran out of IRAM memory so I moved all my variables to ERAM. ... "Are you using all 256k of DSP ram, or have you reserved up to 64k of ...
    (comp.dsp)
  • Re: [OT] Interview with Con Kolivas on Linux failures
    ... On one side there are people who point out that programs often allocate memory that goes unused most of the time, and this memory can be better used as disk cache. ... The ultimate result of this was the addition of a "swappiness" knob to 2.6 kernels to allow people to tune this to their taste. ... I haven't felt the need to tweak swappiness on my desktop machine from the default of 60, but it's also got 1 gigabyte of RAM. ...
    (Debian-User)
  • Re: Tips sought for optimizing 10.4.10s performance
    ... If you're doing graphics or video editing, even more RAM. ... upgrade to disks with those speeds. ... 7200 RPM disks have only had 2MB of cache. ...
    (comp.sys.mac.system)