You are currently offline, waiting for your internet to reconnect

Increased Performance Using FILE_FLAG_SEQUENTIAL_SCAN

This article was previously published under Q98756
There is a flag for CreateFile() called FILE_FLAG_SEQUENTIAL_SCAN whichwill direct the Cache Manager to access the file sequentially.

Anyone reading potentially large files with sequential access can specifythis flag for increased performance. This flag is useful if you are readingfiles that are "mostly" sequential, but you occasionally skip over smallranges of bytes.
The effect on the Cache Manager of this flag is two-fold:
  • There is a minor savings because the Cache Manager dispenses with keeping a history of reads on the file, and tries to maintain a high-water mark on read ahead, which is always a certain delta from the most recent read.
  • More importantly, the Cache Manager reads further ahead for sequential access files--currently about three times more than files that are currently detected for sequential access.
If the caller makes multiple passes through a file, there are no negativeeffects of specifying the sequential flag, because the Cache Manager willstill disable read ahead for as long as the application is getting hits onthe file (such as on the second or subsequent pass).

If you are working on an application where your ability to sequentiallyread file data is key to performance, you may want to consider adding thesequential flag to your create file call. This is especially true ofapplications that use this flag to read from a CD-ROM.
3.10 3.50 4.00

Article ID: 98756 - Last Review: 11/21/2006 15:46:32 - Revision: 2.1

Microsoft Win32 Application Programming Interface

  • KB98756