开发者

Time Consumption of FlushViewOfFile (Windows) and msync(Linux)

We are interested in the time consumption of FlushViewOfFile and msyn开发者_StackOverflow社区c. Quoting the UnmapViewOfFile documentation:

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.

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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜