Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Feb 1996 13:27:28 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        luigi@labinfo.iet.unipi.it (Luigi Rizzo)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Compressed RAM/SWAP
Message-ID:  <199602102027.NAA16493@phaeton.artisoft.com>
In-Reply-To: <199602100936.KAA04409@labinfo.iet.unipi.it> from "Luigi Rizzo" at Feb 10, 96 10:36:46 am

next in thread | previous in thread | raw e-mail | index | archive | help
> Weekend brainstorm: compressed memory/swap.
> I'd like ideas on the subject.
> 
> I am asking because there is a bunch of "RAM doubler" PC/MAC
> utilities. In principle, the same idea could be adopted for FreeBSD.
> But I am a bit worried about cost/performance: compression takes
> time, and keeps the CPU busy, while transferring to disk usually
> leaves the CPU free (except in the case of ISA-IDE controllers).

The "RAM doubler" products are non-products.  For BSD, you might be
able to compress swap, but this is not the same thing.

In general, it is a bad thing to compress swap, because swap contains
only active, dirty pages (BSD is a memory overcommit architecture),
and so it is likely that the swap will be referenced again.

There is an idea I put forward occasionally, which is to put discardable
clean pages from memory into the swap.  This is a win in the general
case because it is faster to recover a page from swap than it is to
recover it from the file system (note: a discarded clean page in this
context is one which is to be removed from the cache with the intent
of recovering it from slow memory [aka disk] later).  This introduces
a number of complications that don't currently exist with only dirty
pages.

> Trying to compress random, single pages yields highly variable 
> results, but usually does better than 2:1. Many pages even compress
> to <100 bytes, they are probably unused or bzeroed.

[ ... ]

Id have to say that "RAMDoubler" is a non-product for most systems
which implement their own virtual memory.  It is, in fact, a VM
mechanism for systems without VM.  For systems with VM (BSD, Win95,
etc.) it seems to do nothing more than burn CPU.

The two caveats on a VM capable system are:

1)	It reduces the swap utilization in trade for CPU cycles;
	on a system where swap dynamically grows (Win95 or
	NeXTStep, etc.), this can be a (very very short term) win
	in a low-space scenario, where it's impractical or disallowed
	to grow the available swap.

2)	It reduces the swap utilization in trade for CPU cycles:
	on a system with a fixed size swap area, this allows you to
	overtax the available swap of an overloaded machine to make
	it an even more overloaded machine.


On the other hand, RAMDoubler sales have been huge.  It's probably
sold more volume than "instant water" (a similar product), so who am
I to rain on your parade.  8-).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602102027.NAA16493>