Windows上的fadvise/madvise等效项是什么? [英] What is fadvise/madvise equivalent on windows?

查看:116
本文介绍了Windows上的fadvise/madvise等效项是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,在UNIX上,我可以使用posix_fadvise(POSIX_FADV_WILLNEED)告诉操作系统将来将需要映射.然后,如果有必要,它将预读数据.

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.

如何告知打算访问Windows?

How to tell the access intend to Windows ?

推荐答案

实际上,正如安德斯(Anders)最常建议的那样,在Windows 7和更早版本中可用的内存管理功能中没有这种方法.

Actually, as Anders mostly suggested, there is no such method in the memory management functions available in Windows 7 and earlier.

存在两种类似的方法:

  • 使用 ReadFileEx 异步读取数据.以后需要时,数据可能仍会保留在文件缓存中.
  • 使用
  • Read the data asynchronously with ReadFileEx. The data might then still be in the file cache when needed later.
  • Open the file with a streaming hint with the FILE_FLAG_SEQUENTIAL_SCAN attribute of CreateFile. Readahead would then perhaps be automatically done.

这篇关于Windows上的fadvise/madvise等效项是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆