开发者

Does SetFileBandwidthReservation affect memory-mapped file performance?

开发者 https://www.devze.com 2023-01-03 15:21 出处:网络
Does this function affect Memory-mapped file performance? Here\'s the problem I need to solve: I have two applications competing for disk access: \"reader\" and \"updater\". Whole system runs on Win

Does this function affect Memory-mapped file performance?

Here's the problem I need to solve:

I have two applications competing for disk access: "reader" and "updater". Whole system runs on Windows Server 2008 R2 x64

"Updater" consta开发者_如何学编程ntly accesses disk in a linear manner, updating data. They system is set up in such a way that updater always has infinite data to update. Consider that it is constantly approximating a solution of a huge set of equations that takes up entire 2TB disk drive. Updater uses ReadFile and WriteFile to process data in a linear fashion.

"Reader" is occasionally invoked by user to get some pieces of data. Usually user would read several 4kb blocks from the drive and stop. Occasionally user needs to read up to 100mb sequentially. In exceptional cases up to several gigabytes. Reader maps files to memory to get data it needs.

What I would like to achieve is for "reader" to have absolute priority so that "updater" would completely stop if needed so that "reader" could get the data user needs ASAP.

Is this problem solvable by using SetPriorityClass and SetFileBandwidthReservation calls?

I would really hate to put synchronization login in "reader" and "updater" and rather have the OS take care of priorities.


Functions you've mentioned have nothing to do with your task, IMO.

Seems like are actually asking for simultaneous file access from multiple processes - and OS will just do what you have asked for. Thus, you'll have to do what you ~hate~ add some sync logic to ensure correctness.

According to your description - opening the file for exclusive access from both reader and updater solves a task of making reader uninterrupted by an updater. The second goal is to make updater interruptible by reader's request.

The way to deal with it depends on whether an updater can be stopped in the middle of its work. In the simple case reader may notify an updater that it has to stop its work ASAP and wait.

0

精彩评论

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

关注公众号