Compartilhar via


Cache Manager (Windows CE 5.0)

Send Feedback

The Cache Manager is a LIB file that the FSD manager can link with to provide disk caching to file systems. This allows disk caching functionality to be used by any file system, including a custom file system. The file system interfaces with the cache through the FSD manager, while the cache interfaces with the disk.

The Cache Manager supports both write-back and write-through modes. In the case of write-back mode, a low-priority lazy-writer thread will commit any dirty cached pages. For more information about the lazy-writer thread, see Lazy-Writer Thread.

The cache is divided into a set of 64K buffers. The block size used for the cache must be less than the buffer size and also must be a power of 2. Dividing the cache into buffers allows the cache to easily be resized depending on memory conditions.

In addition to the cache data itself, a lookup table is implemented as an array of DWORDs that contain the block number that is stored in the cache at a specific cache index. A status table is also implemented as an array of BYTEs, which stores the status for a particular cache index.

On a read, all of the blocks to be read are searched to see if they are in the cache. If one or more blocks are not cached, the entire request is read from the disk and the cache is updated. In the case of a write-back cache, if the request must be read from the disk, the cache region mapping to the blocks to be read is flushed first and then the read action takes place.

On a write, in the case of a write-through cache, the data is written to both the cache and the disk. In the case of a write-back cache, the data is written to the cache and any dirty blocks that must be replaced are committed first.

See Also

Lazy-Writer Thread | Using the FSD Manager | Cache Manager Reference

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.