Reputation: 4680
On UNIX, I can, for example, tell the OS that the mapping will be needed in the future with posix_fadvise(POSIX_FADV_WILLNEED)
. It will then read-ahead the data if it feels so.
How to tell the access intend to Windows ?
Upvotes: 13
Views: 6069
Reputation: 4680
Actually, as Anders mostly suggested, there is no such method in the memory management functions available in Windows 7 and earlier.
2 different ways exists to do something similar :
FILE_FLAG_SEQUENTIAL_SCAN
attribute of CreateFile. Readahead would then perhaps be automatically done.Upvotes: 11
Reputation: 283684
Beginning with Windows 8, there is the PrefetchVirtualMemory
function for this purpose.
Upvotes: 14
Reputation: 101666
You can pass FILE_FLAG_RANDOM_ACCESS
or FILE_FLAG_SEQUENTIAL_SCAN
to CreateFile()
Upvotes: 5