What is the default buffer size for CreateFile on Windows?

When CreateFile is called without the FILE_FLAG_NO_BUFFERING flag, what is the size of the operating system's internal buffer?

If my buffer is larger than Windows internal buffer, can I fully utilize the disk bandwidth?

0


a source to share


3 answers


It probably depends on the version of Windows before the version of Windows, and also depending on the amount of free RAM. Instead of relying on anything specific, you should simply read and write with buffer sizes that are well suited to your application.



0


a source


It depends on how much RAM you have and how the computer is configured. Servers are usually configured to have system cache privilege. You can change this by modifying the following registry key

[HKEY_LOCAL_MACHINE \System \CurrentControlSet \Control \Session Manager \Memory Management] LargeSystemCache

      



Function The SetSystemFileCacheSize function can be used to change the cache size. However, from what I understand, setting the working set size is more of an operating system hint than a hard limit.

As for your second question, I'm not really sure what you mean. I don't see how your buffer size will affect your throughput, but I'm sure someone will correct me if I'm wrong.

0


a source


If you are using non-buffering, there is actually no buffer for I / O other than the one you gave for read / write. (This is with the exception of the compressed files, which are another ball of wax.)

The system cache is ignored in this case, so you need to (see MSDN ) to be careful with the alignment and size of your IO.

0


a source







All Articles