Time-consuming FlushViewOfFile (Windows) and msync (Linux)…. here is a solution to the problem.
Time-consuming FlushViewOfFile (Windows) and msync (Linux).
We FlushViewOfFile
consumes time interest and msync.
Quote 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 ask is that in our application we may not need to minimize the risk of data loss in the event of a system crash.
Thanks,
Solution
They are expensive in the sense of moving cache files from memory to disk. Usually you use memory-mapped files to avoid doing this! A normal policy is to refresh as infrequently as your program requirements allow.