DOUBLE SCAN 95 "RAM DOUBLER" PERFORMANCE/COMPRESSION ANALYZER
-------------------------------------------------------------
Copyright (C) 1995, Mark Russinovich and Bryce Cogswell
You may copy and publish this as long as the authors get credit.

Intro
-----

The Double Scan utiltity determines the fraction of a program's data which 
is compressed by "RAM doublers", as a tool to validate and 
compare manufacturers' claims.

Installing Double Scan
----------------------
Double Scan runs under Windows 3.1 and Windows 95.

To install Double Scan, unpack the files into a directory such as c:\dblscan. 
Next, add a line to "[386Enh]" section of your "\windows\system.ini" file 
of the form
	device=c:\dblscan\dblscan.386

Running Double Scan
-------------------
Begin Double Scan as you would any other Windows program.
The Help button brings up this readme file. The Start button starts the
test. After hitting Start, you will be prompted for a delay period and a
scan string. The delay period represents the length of time that Double
Scan will wait after its test before it scans memory to accumulate results.
This delay gives RAM doublers that claim to compress during Windows idle
periods the opportunity to do so.

The scan string represents the text information that Double Scan fills
the memory it allocates with. It is not really important what the string
is as any reasonable compression algorithm will have no problem
compressing repeated strings of 8 characters in length, but the
compressability will be increased further if you choose a string of
8 identical characters.

Double Scan requires several seconds to several minutes to perform its 
analysis, during which time your machine may not be useable.  To 
ensure accurate and reproducible results you should reboot the machine 
prior to each run, and ensure that no other programs are currently running.
Running the program twice without rebooting may confuse Double Scan into 
miscounting the number of pages being compressed.

See the "Interpreting results" section below for help on how to interpret the 
output of the program.

Background
----------
The size of a computer's RAM memory determines the amount of information
that the system can directly access.  Each program, or block of data used
by a program, requires a portion of the valuable RAM space proportional to
the program's size.  When a machine's RAM is exhausted the system will either 
fail to load additional programs or data, or will be forced to begin storing 
some of the information on the hard disk instead of RAM.  Data being stored 
on the hard disk cannot be directly accessed by the machine; it must first 
be copied into RAM, usually displacing other information which is then copied 
to the hard disk.  The process of copying data from disk before accessing
it can be thousands of times slower than accessing directly in RAM memory.
(This behavior is refered to as "paging" or "virtual memory".)

RAM "multipliers"
-----------------
The principal behind "RAM doublers" is that by compressing the information
in a computer's RAM memory, more programs and data can reside in the machine
simultaneously, and the need to copy information to and from the hard disk
is reduced.  The result is that more and bigger programs can execute 
simultaneously, and performance is increased because more information can
be accessed directly. (Performance will never be as good as if real additional
RAM chips are added to the machine, because the overhead of compressing and
uncompressing the data slows the machine).

Double Scan behavior
--------------------
The Double Scan utility verifies the functionality of a RAM multiplier (the
term "doubler" is a misnomer because it is impossible to guarantee the
specific amount by which data can be compressed and thus memory increased).
It detects what fraction of the data a program uses is actually being 
compressed, and the proportion that is stored in RAM versus stored on the
hard disk.  Double Scan accomplishes this by allocating and using an amount
of memory larger than the system's RAM memory.  In order to satisfy this
request the system is forced to either store some of the information on
the hard disk, or if equiped with a RAM multiplier, to compress some of 
the information in RAM.  While running, Double Scan audits the information
being written to disk, and searches the RAM memory to determine if it can
locate its data in an uncompressed form.  It then reports the total
counts to the user.

Interpreting results
--------------------
Double Scan reports its results in terms of memory "pages."  A page of 
memory is 4096 bytes (4 kilobytes), and when the system allocates or 
manipulates RAM memory it does so in chunks of this size.  Similarly, 
when RAM memory must be copied to or from the hard disk it is done in 
blocks of this size.

The meanings of the numbers reported by Double Scan are as follows:

Pager type: This entry tells you what type of mechanism is being used
by the pager to write to the disk. Here are the possible settings:

	Win3.1		Paging Type
	------		-----------
	NOPG		No paging activity was encountered hence the
			type of pager was not detected
	DOS		You have a temporary swap file so DOS is being
			used to access it
	BIOS		You have a permanent swap file, but your 32-bit
			disk access is disabled
	BLCK		You have a permanent swap file and 32-bit disk
			access is enabled

	Win95		Paging Type
	-----		-----------
	NOPG		No paging activity was encountered hence the
			type of pager was not detected
	DOS		Windows does not recognize your hard drive's type
			so its using DOS to do the accesses
        IFS             The normal case where Windows is using the IFS
			manager to access the swap file

Number of disk writes:  The number of times the system copied information
from memory onto the hard disk.  A larger number translates to worse 
performance.  If compression is taking place this number should be smaller 
than without compression, since a greater fraction of information will be
kept in RAM rather than on the disk.

Number of pages allocated:  This is the total amount of memory that Double 
Scan requested from the system.  Some fraction of this memory will be in 
RAM, some will be on the hard disk, and some will be compressed by any 
existing RAM multiplier.

Number of pages in RAM:  This is the number of pages that Double Scan 
allocated that were stored in RAM in an uncompressed form.

Number of pages on disk:  This is the number of pages that Double Scan 
allocated that were stored on the hard disk in an uncompressed form.

Total pages found:  This is the number of pages that Double Scan 
allocated that were uncompressed by a RAM multiplier.  If this number
comes out to a number larger than the total pages allocated, it means
that there is some internal buffering being used by either the
RAM doubler or the disk subsystem and it represents redundant un-used
information.

Total time:  This is the amount of time required to run the experiment not
including clean-up time at the end. A quality RAM multiplier should reduce
this time by reducing the amount of information copied to the disk. If
you specified a delay for memory scan, then the time represents time up
to the point where Double Scan started to wait for the delay period
to expire.

If the number of pages reported as being compressed is close to zero, then
the RAM multiplier you have installed is not functioning correctly.

If a good RAM doubler is being used, then what you should see is the
following:

	1) a drop in the number of disk writes under the RAM doubler versus
	   without, since more pages are kept in RAM due to compression

	2) a drop in the total time under the RAM doubler since there 
	   are fewer disk accesses and compression should be faster than
	   disk accesses

	3) a drop in the number of pages found on disk and in RAM since
	   compression will prevent Double Scan from finding its signature

**********************************************************************

IF YOU DO NOT SEE ANY DIFFERENCE IN PAGES FOUND AND PAGES ALLOCATED
                THERE IS _NO_ COMPRESSION BEING USED

**********************************************************************

Example Results
---------------
A thorough comparison has been made between native Windows, Syncronous
Softcorps.'s SoftRAM95, Quarterdeck's MagnaRAM2 and Connectix's RAM 
Doubler (Windows 3.1 only). Runs were executed for each setup for each
of the three Windows 3.1 paging types (see above) as well as Windows 95.

Example screen-shots for runs under Windows 3.1 are in the Windows 3.1
Write file "rslt31.doc." Example screen-shots for runs under Windows 95 are in the WordPad
document "rslt95.doc."

The following table summarizes the results of the experiments:

Windows 3.1: Temporary Paging File, DOS Paging
----------------------------------------------
		Pages Compressed		Time
Native			0			 31 
SoftRAM			0			 34
RAM Doubler	      818			 14		
MagnaRAM             1617			 15

Windows 3.1: Permanent Paging File, BIOS Paging
-----------------------------------------------
		Pages Compressed		Time
Native			0			 25
SoftRAM			0			 27
RAM Doubler	      918			 14		
MagnaRAM             1565			 12

Windows 3.1: Permanent Paging File, Blockdev Paging
---------------------------------------------------
		Pages Compressed		Time
Native			0			 21
SoftRAM			0			 19
RAM Doubler	      918			 14		
MagnaRAM             1344			 12

Windows 95: IFS Manager Paging
------------------------------
		Pages Compressed		Time
Native			0			 18
SoftRAM			0			 18
MagnaRAM             3040			 12

The results indicate that under the test conditions, SoftRAM does
not perform any compression while MagnaRAM and RAM Doubler both do.
Runs were made on SoftRAM with delays of 30 seconds and the results
were identical to those in the above summary table. This result
is consistent with the conclusion that SoftRAM does not use compression.

The Double Scan algorithm
-------------------------
Double Scan detects the number of pages being compressed by allocating pages
and filling them with an easily recognized signature string.  It hooks the
disk read/write services, and while executing counts the number of pages
that are written to disk containing this signature.  Written pages that 
have been compressed will no longer have the signature clearly visible, 
while uncompressed pages are easily detected.

When all memory is allocated and filled (some of which will have been 
written to disk), Double Scan scans through the machine's RAM and counts 
the number of pages in RAM that have not been compressed.  The total number
of uncompressed pages is computed by adding the uncompressed count on 
disk and uncompressed count in RAM.


Modifying and recompiling the sources
-------------------------------------
Double Scan is free software, and may be freely modified and redistributed.
Double Scan was built using Visual C 1.5 and VTools 1.11.
