Windows上的fadvise/madvise等效项是什么?

编程入门 行业动态 更新时间:2024-10-24 07:33:37
本文介绍了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 异步读取数据.以后需要时,数据可能仍会保留在文件缓存中.
  • 使用 CreateFile .预读可能会自动完成.
  • 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等效项是什么?

本文发布于:2023-10-07 15:29:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469779.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Windows   fadvise   madvise

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!