FlushViewOfFile(Windows)和msync(Linux)的时间消耗 [英] Time Consumption of FlushViewOfFile (Windows) and msync(Linux)

查看:949
本文介绍了FlushViewOfFile(Windows)和msync(Linux)的时间消耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,

我们对 FlushViewOfFile msync 。引用 UnmapViewOfFile 文档

We are interested in the time consumption of FlushViewOfFile and msync. Quoting the UnmapViewOfFile documentation:


为了最大限度降低电源故障或系统崩溃时数据丢失的风险,应用程序应使用 FlushViewOfFile 函数显式刷新修改的页面。

To minimize the risk of data loss in the event of a power failure or a system crash, applications should explicitly flush modified pages using the FlushViewOfFile function.

c $ c> FlushViewOfFile()和 msync()昂贵的操作?我们要求的原因是,在我们的应用程序中,我们可能不需要最小化在系统崩溃的情况下数据丢失的风险。

Are FlushViewOfFile() and msync() expensive operations? The reason we are asking is that in our application, we may not need to minimize the risk of data loss in the event of a system crash.

谢谢你, p>

Thank you,

推荐答案

它们是昂贵的,因为它们会将缓存文件从内存移动到磁盘。通常你使用内存映射文件,以避免这样做!正常的策略是在你的程序需求允许时尽快刷新。

They are expensive in the sense that they will move the cached file from memory to disk. Generally you use memory mapped files to avoid doing that! The normal strategy is to flush as infrequently as your program requirements allow.

这篇关于FlushViewOfFile(Windows)和msync(Linux)的时间消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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