Sysinternals Freeware - Mark Russinovich & Bryce Cogswell

TVCache

Copyright 1996 Mark Russinovich
Last Updated: July 9, 1997

Introduction

TVCACHE is a replacement for VCACHE that implements compression on cached blocks in an attempt to improve performance (our benchmarks show that it doesn't fare too great). In any case, we are posting the complete source for TVCACHE because the VCACHE interface is undocumented. The source presented here is the only complete specification for the VCACHE interface that we are aware of. Note that the source is presented solely for educational purposes and is not licensed for commercial use.

How it Works

In yet another brilliant design move, the current implementation of Windows 95 does not provide any official way to replace the default VCACHE with an alternate VxD. However, TVCACHE overcomes this limitation by replacing the function pointers in the VCACHE service table with pointers to its own routines before VCACHE is activated for the first time. Thus, using VCACHE's Device Declaration Block, TVCACHE subsumes VCACHE's role as the cache manager for Windows.

Once active, TVCACHE actually does much more work than VCACHE needs to do. This extra work involves fragmented memory management and compressed buffer management. VCACHE only has to deal with page sized (4K) chunks, whereas TVCACHE must deal with almost arbitrary sized chunks of data (in 128 byte increments). TVCACHE mimics VCACHE's exact policy of cache growing and shrinking and our benchmarks show VCACHE and TVCACHE (with compression disabled) have identical performance characteristics.

Whether you are writing your own Windows 95 file system driver, just curious about how VCACHE works, or want to experiment with VCACHE grow/shrink policies, TVCACHE serves as the only source of precise and accurate information on how VCACHE actually functions internally.

Building TVCache

TVCACHE is a Windows 95 VxD that is written in C, and it requires VtoolsD Version 2.0 or greater to build. Defining the TESTING flag has the build produce a stand-alone Windows console program that stress tests the TVCACHE code by simulating multi-threaded cache accesses. Setting COMPRESSON to 0 disables compression so that TVCACHE functions in a manner similar to VCACHE.

Installing TVCache

To install TVCACHE, add the following line to the [386enh] section of system.ini:

device=<path>\tvcache.vxd

where <path> is the directory in which tvache.vxd is located. You must reboot your machine for TVCACHE to start.

More Information

The VCACHE interface is only partially documented in the Windows 95 DDK, and there are no guidelines for using it. While we're not taking the time to write up a document on the VCACHE interface specification, the source to TVCACHE indirectly documents everything you need to know. In its stress testing of TVCACHE code, the main() test function at the bottom of vcache.c serves as an example of how the VCACHE interface is used.

Let us know if you find TVCACHE useful.

Download TVCACHE (72KB)

Back to Top